docker.scm 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2016 David Thompson <davet@gnu.org>
  3. ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
  4. ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
  5. ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (gnu packages docker)
  22. #:use-module ((guix licenses) #:prefix license:)
  23. #:use-module (gnu packages)
  24. #:use-module (guix packages)
  25. #:use-module (guix download)
  26. #:use-module (guix git-download)
  27. #:use-module (guix build-system gnu)
  28. #:use-module (guix build-system go)
  29. #:use-module (guix build-system python)
  30. #:use-module (guix utils)
  31. #:use-module (gnu packages autotools)
  32. #:use-module (gnu packages base)
  33. #:use-module (gnu packages check)
  34. #:use-module (gnu packages compression)
  35. #:use-module (gnu packages glib)
  36. #:use-module (gnu packages golang)
  37. #:use-module (gnu packages linux)
  38. #:use-module (gnu packages pkg-config)
  39. #:use-module (gnu packages python)
  40. #:use-module (gnu packages python-web)
  41. #:use-module (gnu packages python-xyz)
  42. #:use-module (gnu packages version-control)
  43. #:use-module (gnu packages virtualization))
  44. (define %docker-version "18.09.2")
  45. (define-public python-docker-py
  46. (package
  47. (name "python-docker-py")
  48. (version "1.10.6")
  49. (source
  50. (origin
  51. (method url-fetch)
  52. (uri (pypi-uri "docker-py" version))
  53. (sha256
  54. (base32
  55. "05f49f6hnl7npmi7kigg0ibqk8s3fhzx1ivvz1kqvlv4ay3paajc"))))
  56. (build-system python-build-system)
  57. ;; TODO: Tests require a running Docker daemon.
  58. (arguments '(#:tests? #f))
  59. (inputs
  60. `(("python-requests" ,python-requests)
  61. ("python-six" ,python-six)
  62. ("python-websocket-client" ,python-websocket-client)))
  63. (home-page "https://github.com/docker/docker-py/")
  64. (synopsis "Python client for Docker")
  65. (description "Docker-Py is a Python client for the Docker container
  66. management tool.")
  67. (license license:asl2.0)))
  68. (define-public python-dockerpty
  69. (package
  70. (name "python-dockerpty")
  71. (version "0.3.4")
  72. (source
  73. (origin
  74. (method url-fetch)
  75. (uri (pypi-uri "dockerpty" version))
  76. (sha256
  77. (base32
  78. "0za6rr349641wv76ww9l3zcic2xyxrirlxpnzl4296h897648455"))))
  79. (build-system python-build-system)
  80. (native-inputs
  81. `(("python-six" ,python-six)))
  82. (home-page "https://github.com/d11wtq/dockerpty")
  83. (synopsis "Python library to use the pseudo-TTY of a Docker container")
  84. (description "Docker PTY provides the functionality needed to operate the
  85. pseudo-terminal (PTY) allocated to a Docker container using the Python
  86. client.")
  87. (license license:asl2.0)))
  88. (define-public docker-compose
  89. (package
  90. (name "docker-compose")
  91. (version "1.5.2")
  92. (source
  93. (origin
  94. (method url-fetch)
  95. (uri (pypi-uri "docker-compose" version))
  96. (sha256
  97. (base32
  98. "0ksg7hm2yvc977968dixxisrhcmvskzpcx3pz0v1kazrdqp7xakr"))))
  99. (build-system python-build-system)
  100. ;; TODO: Tests require running Docker daemon.
  101. (arguments '(#:tests? #f))
  102. (inputs
  103. `(("python-docker-py" ,python-docker-py)
  104. ("python-dockerpty" ,python-dockerpty)
  105. ("python-docopt" ,python-docopt)
  106. ("python-jsonschema" ,python-jsonschema)
  107. ("python-pyyaml" ,python-pyyaml)
  108. ("python-requests" ,python-requests-2.7)
  109. ("python-six" ,python-six)
  110. ("python-texttable" ,python-texttable)
  111. ("python-websocket-client" ,python-websocket-client)))
  112. (home-page "https://www.docker.com/")
  113. (synopsis "Multi-container orchestration for Docker")
  114. (description "Docker Compose is a tool for defining and running
  115. multi-container Docker applications. A Compose file is used to configure an
  116. application’s services. Then, using a single command, the containers are
  117. created and all the services are started as specified in the configuration.")
  118. (license license:asl2.0)))
  119. (define-public python-docker-pycreds
  120. (package
  121. (name "python-docker-pycreds")
  122. (version "0.3.0")
  123. (source
  124. (origin
  125. (method url-fetch)
  126. (uri (pypi-uri "docker-pycreds" version))
  127. (sha256
  128. (base32
  129. "1zxvam1q22qb0jf48553nnncnfrcp88ag4xa0qmq6vr0imn9a3lb"))))
  130. (build-system python-build-system)
  131. (arguments
  132. `(#:phases
  133. (modify-phases %standard-phases
  134. (add-after 'unpack 'fix-versioning
  135. (lambda _
  136. (substitute* "test-requirements.txt"
  137. (("3.0.2") ,(package-version python-pytest))
  138. (("2.3.1") ,(package-version python-pytest-cov))
  139. (("2.4.1") ,(package-version python-flake8)))
  140. #t)))))
  141. (native-inputs
  142. `(("python-flake8" ,python-flake8)
  143. ("python-pytest" ,python-pytest)
  144. ("python-pytest-cov" ,python-pytest-cov)))
  145. (propagated-inputs
  146. `(("python-six" ,python-six)))
  147. (home-page "https://github.com/shin-/dockerpy-creds")
  148. (synopsis
  149. "Python bindings for the Docker credentials store API")
  150. (description
  151. "Docker-Pycreds contains the Python bindings for the docker credentials
  152. store API. It allows programmers to interact with a Docker registry using
  153. Python without keeping their credentials in a Docker configuration file.")
  154. (license license:asl2.0)))
  155. (define-public containerd
  156. (package
  157. (name "containerd")
  158. (version "1.2.4")
  159. (source
  160. (origin
  161. (method git-fetch)
  162. (uri (git-reference
  163. (url "https://github.com/containerd/containerd.git")
  164. (commit (string-append "v" version))))
  165. (file-name (git-file-name name version))
  166. (sha256
  167. (base32 "1rw7f0y3iv0mapxid1rgpns80dcy8nhgmxmw27x8qzrzic5viivy"))))
  168. (build-system go-build-system)
  169. (arguments
  170. `(#:import-path "github.com/containerd/containerd"
  171. #:phases
  172. (modify-phases %standard-phases
  173. (add-before 'build 'chdir
  174. (lambda _
  175. (chdir "src/github.com/containerd/containerd")
  176. #t))
  177. (add-after 'chdir 'patch-paths
  178. (lambda* (#:key inputs outputs #:allow-other-keys)
  179. ;; TODO: Patch "socat", "unpigz".
  180. (substitute* "./runtime/v1/linux/runtime.go"
  181. (("defaultRuntime[ \t]*=.*")
  182. (string-append "defaultRuntime = \""
  183. (assoc-ref inputs "runc")
  184. "/sbin/runc\"\n"))
  185. (("defaultShim[ \t]*=.*")
  186. (string-append "defaultShim = \""
  187. (assoc-ref outputs "out")
  188. "/bin/containerd-shim\"\n")))
  189. (substitute* "./vendor/github.com/containerd/go-runc/runc.go"
  190. (("DefaultCommand[ \t]*=.*")
  191. (string-append "DefaultCommand = \""
  192. (assoc-ref inputs "runc")
  193. "/sbin/runc\"\n")))
  194. (substitute* "vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go"
  195. (("exec\\.Command\\(\"losetup\"") ; )
  196. (string-append "exec.Command(\""
  197. (assoc-ref inputs "util-linux")
  198. "/sbin/losetup\""))) ;)
  199. #t))
  200. (replace 'build
  201. (lambda* (#:key (make-flags '()) #:allow-other-keys)
  202. (apply invoke "make" make-flags)))
  203. (replace 'install
  204. (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
  205. (let* ((out (assoc-ref outputs "out")))
  206. (apply invoke "make" (string-append "DESTDIR=" out) "install"
  207. make-flags)))))))
  208. (inputs
  209. `(("btrfs-progs" ,btrfs-progs)
  210. ("libseccomp" ,libseccomp)
  211. ("runc" ,runc)
  212. ("util-linux" ,util-linux)))
  213. (native-inputs
  214. `(("go" ,go)
  215. ("pkg-config" ,pkg-config)))
  216. (synopsis "Docker container runtime")
  217. (description "This package provides the container daemon for Docker.
  218. It includes image transfer and storage, container execution and supervision,
  219. network attachments.")
  220. (home-page "http://containerd.io/")
  221. (license license:asl2.0)))
  222. (define-public docker
  223. (package
  224. (name "docker")
  225. (version %docker-version)
  226. (source
  227. (origin
  228. (method git-fetch)
  229. (uri (git-reference
  230. (url "https://github.com/docker/engine.git")
  231. (commit (string-append "v" version))))
  232. (file-name (git-file-name name version))
  233. (sha256
  234. (base32
  235. "1zfpk2n8j6gnwbrxrh6d6pj24y60dhbanpf55shrm2yxz54ka36c"))
  236. (patches
  237. (search-patches "docker-engine-test-noinstall.patch"
  238. "docker-fix-tests.patch"))))
  239. (build-system gnu-build-system)
  240. (arguments
  241. `(#:modules
  242. ((guix build gnu-build-system)
  243. ((guix build go-build-system) #:prefix go:)
  244. (guix build utils))
  245. #:imported-modules
  246. (,@%gnu-build-system-modules
  247. (guix build go-build-system))
  248. #:phases
  249. (modify-phases %standard-phases
  250. (add-after 'unpack 'patch-paths
  251. (lambda* (#:key inputs #:allow-other-keys)
  252. (substitute* "builder/builder-next/executor_unix.go"
  253. (("CommandCandidates:.*runc.*")
  254. (string-append "CommandCandidates: []string{\""
  255. (assoc-ref inputs "runc")
  256. "/sbin/runc\"},\n")))
  257. (substitute* "vendor/github.com/containerd/go-runc/runc.go"
  258. (("DefaultCommand = .*")
  259. (string-append "DefaultCommand = \""
  260. (assoc-ref inputs "runc")
  261. "/sbin/runc\"\n")))
  262. (substitute* "vendor/github.com/containerd/containerd/runtime/v1/linux/runtime.go"
  263. (("defaultRuntime[ \t]*=.*")
  264. (string-append "defaultRuntime = \""
  265. (assoc-ref inputs "runc")
  266. "/sbin/runc\"\n"))
  267. (("defaultShim[ \t]*=.*")
  268. (string-append "defaultShim = \""
  269. (assoc-ref inputs "containerd")
  270. "/bin/containerd-shim\"\n")))
  271. (substitute* "daemon/daemon_unix.go"
  272. (("DefaultShimBinary = .*")
  273. (string-append "DefaultShimBinary = \""
  274. (assoc-ref inputs "containerd")
  275. "/bin/containerd-shim\"\n"))
  276. (("DefaultRuntimeBinary = .*")
  277. (string-append "DefaultRuntimeBinary = \""
  278. (assoc-ref inputs "runc")
  279. "/sbin/runc\"\n"))
  280. (("DefaultRuntimeName = .*")
  281. (string-append "DefaultRuntimeName = \""
  282. (assoc-ref inputs "runc")
  283. "/sbin/runc\"\n")))
  284. (substitute* "daemon/config/config.go"
  285. (("StockRuntimeName = .*")
  286. (string-append "StockRuntimeName = \""
  287. (assoc-ref inputs "runc")
  288. "/sbin/runc\"\n")))
  289. (substitute* "vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go"
  290. (("var defaultCommandCandidates = .*")
  291. (string-append "var defaultCommandCandidates = []string{\""
  292. (assoc-ref inputs "runc") "/sbin/runc\"}")))
  293. (let ((source-files (filter (lambda (name)
  294. (not (string-contains name "test")))
  295. (find-files "." "\\.go$"))))
  296. (let-syntax ((substitute-LookPath
  297. (lambda (x)
  298. (syntax-case x ()
  299. ((substitute-LookPath source-text package
  300. relative-path)
  301. #`(substitute* source-files
  302. ((#,(string-append "exec\\.LookPath\\(\""
  303. (syntax->datum
  304. #'source-text)
  305. "\")"))
  306. (string-append "\""
  307. (assoc-ref inputs package)
  308. relative-path
  309. "\", error(nil)")))))))
  310. (substitute-Command
  311. (lambda (x)
  312. (syntax-case x ()
  313. ((substitute-LookPath source-text package
  314. relative-path)
  315. #`(substitute* source-files
  316. ((#,(string-append "exec\\.Command\\(\""
  317. (syntax->datum
  318. #'source-text)
  319. "\"")) ; )
  320. (string-append "exec.Command(\""
  321. (assoc-ref inputs package)
  322. relative-path
  323. "\"")))))))) ; )
  324. (substitute-LookPath "ps" "procps" "/bin/ps")
  325. (substitute-LookPath "mkfs.xfs" "xfsprogs" "/bin/mkfs.xfs")
  326. (substitute-LookPath "lvmdiskscan" "lvm2" "/sbin/lvmdiskscan")
  327. (substitute-LookPath "pvdisplay" "lvm2" "/sbin/pvdisplay")
  328. (substitute-LookPath "blkid" "util-linux" "/sbin/blkid")
  329. (substitute-LookPath "unpigz" "pigz" "/bin/unpigz")
  330. (substitute-LookPath "iptables" "iptables" "/sbin/iptables")
  331. (substitute-LookPath "iptables-legacy" "iptables" "/sbin/iptables")
  332. (substitute-LookPath "ip" "iproute2" "/sbin/ip")
  333. (substitute-Command "modprobe" "kmod" "/bin/modprobe")
  334. (substitute-Command "pvcreate" "lvm2" "/sbin/pvcreate")
  335. (substitute-Command "vgcreate" "lvm2" "/sbin/vgcreate")
  336. (substitute-Command "lvcreate" "lvm2" "/sbin/lvcreate")
  337. (substitute-Command "lvconvert" "lvm2" "/sbin/lvconvert")
  338. (substitute-Command "lvchange" "lvm2" "/sbin/lvchange")
  339. (substitute-Command "mkfs.xfs" "xfsprogs" "/sbin/mkfs.xfs")
  340. (substitute-Command "xfs_growfs" "xfsprogs" "/sbin/xfs_growfs")
  341. (substitute-Command "mkfs.ext4" "e2fsprogs" "/sbin/mkfs.ext4")
  342. (substitute-Command "tune2fs" "e2fsprogs" "/sbin/tune2fs")
  343. (substitute-Command "blkid" "util-linux" "/sbin/blkid")
  344. (substitute-Command "resize2fs" "e2fsprogs" "/sbin/resize2fs")
  345. ; docker-mountfrom ??
  346. ; docker
  347. ; docker-untar ??
  348. ; docker-applyLayer ??
  349. ; /usr/bin/uname
  350. ; grep
  351. ; apparmor_parser
  352. (substitute-Command "ps" "procps" "/bin/ps")
  353. (substitute-Command "losetup" "util-linux" "/sbin/losetup")
  354. (substitute-Command "uname" "coreutils" "/bin/uname")
  355. (substitute-Command "dbus-launch" "dbus" "/bin/dbus-launch")
  356. (substitute-Command "git" "git" "/bin/git"))
  357. ;; Make compilation fail when, in future versions, Docker
  358. ;; invokes other programs we don't know about and thus don't
  359. ;; substitute.
  360. (substitute* source-files
  361. ;; Search for Java in PATH.
  362. (("\\<exec\\.Command\\(\"java\"") ; )
  363. "xxec.Command(\"java\"") ; )
  364. ;; Search for AUFS in PATH (mainline Linux doesn't support it).
  365. (("\\<exec\\.Command\\(\"auplink\"") ; )
  366. "xxec.Command(\"auplink\"") ; )
  367. ;; Fail on other unsubstituted commands.
  368. (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\""
  369. _ executable) ; )
  370. (string-append "exec.Guix_doesnt_want_Command(\""
  371. executable "\"")) ;)
  372. (("\\<xxec\\.Command")
  373. "exec.Command")
  374. ;; Search for ZFS in PATH.
  375. (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")")
  376. ;; Fail on other unsubstituted LookPaths.
  377. (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"") ; ))
  378. (("\\<LooxPath") "LookPath")))
  379. #t))
  380. (add-after 'patch-paths 'delete-failing-tests
  381. (lambda _
  382. ;; Needs internet access.
  383. (delete-file "builder/remotecontext/git/gitutils_test.go")
  384. ;; Permission denied.
  385. (delete-file "daemon/graphdriver/devmapper/devmapper_test.go")
  386. ;; Operation not permitted (idtools.MkdirAllAndChown).
  387. (delete-file "daemon/graphdriver/vfs/vfs_test.go")
  388. ;; Timeouts after 5 min.
  389. (delete-file "plugin/manager_linux_test.go")
  390. ;; Operation not permitted.
  391. (delete-file "daemon/graphdriver/btrfs/btrfs_test.go")
  392. (delete-file "daemon/graphdriver/overlay/overlay_test.go")
  393. (delete-file "daemon/graphdriver/overlay2/overlay_test.go")
  394. #t))
  395. (replace 'configure
  396. (lambda _
  397. (setenv "DOCKER_GITCOMMIT" (string-append "v" ,%docker-version))
  398. ;; Automatically use bundled dependencies.
  399. ;; TODO: Unbundle - see file "vendor.conf".
  400. (setenv "AUTO_GOPATH" "1")
  401. ;; Respectively, strip the symbol table and debug
  402. ;; information, and the DWARF symbol table.
  403. (setenv "LDFLAGS" "-s -w")
  404. ;; Make build faster
  405. (setenv "GOCACHE" "/tmp")
  406. #t))
  407. (add-before 'build 'setup-environment
  408. (assoc-ref go:%standard-phases 'setup-environment))
  409. (replace 'build
  410. (lambda _
  411. ;; Our LD doesn't like the statically linked relocatable things
  412. ;; that go produces, so install the dynamic version of
  413. ;; dockerd instead.
  414. (invoke "hack/make.sh" "dynbinary")))
  415. (replace 'check
  416. (lambda _
  417. ;; The build process generated a file because the environment
  418. ;; variable "AUTO_GOPATH" was set. Use it.
  419. (setenv "GOPATH" (string-append (getcwd) "/.gopath"))
  420. ;; ".gopath/src/github.com/docker/docker" is a link to the current
  421. ;; directory and chdir would canonicalize to that.
  422. ;; But go needs to have the uncanonicalized directory name, so
  423. ;; store that.
  424. (setenv "PWD" (string-append (getcwd)
  425. "/.gopath/src/github.com/docker/docker"))
  426. (with-directory-excursion ".gopath/src/github.com/docker/docker"
  427. (invoke "hack/test/unit"))
  428. (setenv "PWD" #f)
  429. #t))
  430. (replace 'install
  431. (lambda* (#:key outputs #:allow-other-keys)
  432. (let* ((out (assoc-ref outputs "out"))
  433. (out-bin (string-append out "/bin")))
  434. (install-file "bundles/dynbinary-daemon/dockerd" out-bin)
  435. (install-file "bundles/dynbinary-daemon/dockerd-dev" out-bin)
  436. #t))))))
  437. (inputs
  438. `(("btrfs-progs" ,btrfs-progs)
  439. ("containerd" ,containerd) ; for containerd-shim
  440. ("coreutils" ,coreutils)
  441. ("dbus" ,dbus)
  442. ("e2fsprogs" ,e2fsprogs)
  443. ("git" ,git)
  444. ("iproute2" ,iproute)
  445. ("iptables" ,iptables)
  446. ("kmod" ,kmod)
  447. ("libseccomp" ,libseccomp)
  448. ("pigz" ,pigz)
  449. ("procps" ,procps)
  450. ("runc" ,runc)
  451. ("util-linux" ,util-linux)
  452. ("lvm2" ,lvm2)
  453. ("xfsprogs" ,xfsprogs)))
  454. (native-inputs
  455. `(("eudev" ,eudev) ; TODO: Should be propagated by lvm2 (.pc -> .pc)
  456. ("go" ,go)
  457. ("pkg-config" ,pkg-config)))
  458. (synopsis "Docker container component library, and daemon")
  459. (description "This package provides a framework to assemble specialized
  460. container systems. It includes components for orchestration, image
  461. management, secret management, configuration management, networking,
  462. provisioning etc.")
  463. (home-page "https://mobyproject.org/")
  464. (license license:asl2.0)))
  465. (define-public docker-cli
  466. (package
  467. (name "docker-cli")
  468. (version %docker-version)
  469. (source
  470. (origin
  471. (method git-fetch)
  472. (uri (git-reference
  473. (url "https://github.com/docker/cli.git")
  474. (commit (string-append "v" version))))
  475. (file-name (git-file-name name version))
  476. (sha256
  477. (base32
  478. "0jzcqh1kqbfyj6ax7z67gihaqgjiz6ddz6rq6k458l68v7zn77r8"))))
  479. (build-system go-build-system)
  480. (arguments
  481. `(#:import-path "github.com/docker/cli"
  482. ;; TODO: Tests require a running Docker daemon.
  483. #:tests? #f
  484. #:phases
  485. (modify-phases %standard-phases
  486. (add-before 'build 'setup-environment-2
  487. (lambda _
  488. ;; Respectively, strip the symbol table and debug
  489. ;; information, and the DWARF symbol table.
  490. (setenv "LDFLAGS" "-s -w")
  491. ;; Make build reproducible.
  492. (setenv "BUILDTIME" "1970-01-01 00:00:01.000000000+00:00")
  493. (symlink "src/github.com/docker/cli/scripts" "./scripts")
  494. (symlink "src/github.com/docker/cli/docker.Makefile" "./docker.Makefile")
  495. #t))
  496. (replace 'build
  497. (lambda _
  498. (invoke "./scripts/build/dynbinary")))
  499. (replace 'check
  500. (lambda* (#:key make-flags tests? #:allow-other-keys)
  501. (setenv "PATH" (string-append (getcwd) "/build:" (getenv "PATH")))
  502. (if tests?
  503. ;; Use the newly-built docker client for the tests.
  504. (with-directory-excursion "src/github.com/docker/cli"
  505. ;; TODO: Run test-e2e as well?
  506. (apply invoke "make" "-f" "docker.Makefile" "test-unit"
  507. (or make-flags '())))
  508. #t)))
  509. (replace 'install
  510. (lambda* (#:key outputs #:allow-other-keys)
  511. (let* ((out (assoc-ref outputs "out"))
  512. (out-bin (string-append out "/bin")))
  513. (chdir "build")
  514. (install-file "docker" out-bin)
  515. #t))))))
  516. (native-inputs
  517. `(("go" ,go)
  518. ("libltdl" ,libltdl)
  519. ("pkg-config" ,pkg-config)))
  520. (synopsis "Command line interface to Docker")
  521. (description "This package provides a command line interface to Docker.")
  522. (home-page "https://www.docker.com/")
  523. (license license:asl2.0)))
  524. (define-public cqfd
  525. (package
  526. (name "cqfd")
  527. (version "5.0.1")
  528. (source (origin
  529. (method git-fetch)
  530. (uri (git-reference
  531. (url "https://github.com/savoirfairelinux/cqfd.git")
  532. (commit (string-append "v" version))))
  533. (file-name (git-file-name name version))
  534. (sha256
  535. (base32
  536. "1z4v16lbpbwd5ykawizdclpryp2k006lbk2mv427a4b3nvcd9wik"))))
  537. (build-system gnu-build-system)
  538. (arguments
  539. ;; The test suite requires a docker daemon and connectivity.
  540. `(#:tests? #f
  541. #:phases
  542. (modify-phases %standard-phases
  543. (delete 'configure)
  544. (delete 'build)
  545. (replace 'install
  546. (lambda* (#:key outputs #:allow-other-keys)
  547. (let ((out (assoc-ref outputs "out")))
  548. ;; Fix the directory of the bash completion.
  549. (substitute* "Makefile"
  550. (("completionsdir=.*$")
  551. (string-append "completionsdir=" out
  552. "/etc/bash_completion.d; \\\n")))
  553. (invoke "make" "install"
  554. (string-append "PREFIX=" out))))))))
  555. (home-page "https://github.com/savoirfairelinux/cqfd")
  556. (synopsis "Convenience wrapper for Docker")
  557. (description "cqfd is a Bash script that provides a quick and convenient
  558. way to run commands in the ecurrent directory, but within a Docker container
  559. defined in a per-project configuration file.")
  560. (license license:gpl3+)))