Commit | Line | Data |
---|---|---|
d020bfc2 DT |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2016 David Thompson <davet@gnu.org> | |
42531fd3 | 3 | ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il> |
26b7d23a | 4 | ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
975a953b | 5 | ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
d020bfc2 DT |
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 | ||
22 | (define-module (gnu packages docker) | |
23 | #:use-module ((guix licenses) #:prefix license:) | |
24 | #:use-module (gnu packages) | |
25 | #:use-module (guix packages) | |
26 | #:use-module (guix download) | |
27 | #:use-module (guix git-download) | |
f87ea24a | 28 | #:use-module (guix build-system gnu) |
4e5b8f72 | 29 | #:use-module (guix build-system go) |
d020bfc2 DT |
30 | #:use-module (guix build-system python) |
31 | #:use-module (guix utils) | |
e9b31645 | 32 | #:use-module (gnu packages autotools) |
58adcaa1 | 33 | #:use-module (gnu packages base) |
42531fd3 | 34 | #:use-module (gnu packages check) |
f87ea24a | 35 | #:use-module (gnu packages compression) |
6b6a25d4 | 36 | #:use-module (gnu packages glib) |
4e5b8f72 DM |
37 | #:use-module (gnu packages golang) |
38 | #:use-module (gnu packages linux) | |
0b94911a | 39 | #:use-module (gnu packages networking) |
4e5b8f72 | 40 | #:use-module (gnu packages pkg-config) |
1b2f753d | 41 | #:use-module (gnu packages python) |
1f1e338a | 42 | #:use-module (gnu packages python-web) |
44d10b1f | 43 | #:use-module (gnu packages python-xyz) |
6b6a25d4 | 44 | #:use-module (gnu packages version-control) |
1f1e338a | 45 | #:use-module (gnu packages virtualization)) |
d020bfc2 | 46 | |
0e84987f | 47 | (define %docker-version "18.09.5") |
f87ea24a | 48 | |
d020bfc2 DT |
49 | (define-public python-docker-py |
50 | (package | |
51 | (name "python-docker-py") | |
b24da117 | 52 | (version "1.10.6") |
d020bfc2 DT |
53 | (source |
54 | (origin | |
55 | (method url-fetch) | |
56 | (uri (pypi-uri "docker-py" version)) | |
57 | (sha256 | |
58 | (base32 | |
b24da117 | 59 | "05f49f6hnl7npmi7kigg0ibqk8s3fhzx1ivvz1kqvlv4ay3paajc")))) |
d020bfc2 DT |
60 | (build-system python-build-system) |
61 | ;; TODO: Tests require a running Docker daemon. | |
62 | (arguments '(#:tests? #f)) | |
63 | (inputs | |
64 | `(("python-requests" ,python-requests) | |
d020bfc2 DT |
65 | ("python-six" ,python-six) |
66 | ("python-websocket-client" ,python-websocket-client))) | |
67 | (home-page "https://github.com/docker/docker-py/") | |
68 | (synopsis "Python client for Docker") | |
69 | (description "Docker-Py is a Python client for the Docker container | |
70 | management tool.") | |
71 | (license license:asl2.0))) | |
b42c9c81 DT |
72 | |
73 | (define-public python-dockerpty | |
74 | (package | |
75 | (name "python-dockerpty") | |
8bb591d4 | 76 | (version "0.4.1") |
b42c9c81 DT |
77 | (source |
78 | (origin | |
79 | (method url-fetch) | |
80 | (uri (pypi-uri "dockerpty" version)) | |
81 | (sha256 | |
82 | (base32 | |
8bb591d4 | 83 | "1kjn64wx23jmr8dcc6g7bwlmrhfmxr77gh6iphqsl39sayfxdab9")))) |
b42c9c81 DT |
84 | (build-system python-build-system) |
85 | (native-inputs | |
86 | `(("python-six" ,python-six))) | |
87 | (home-page "https://github.com/d11wtq/dockerpty") | |
88 | (synopsis "Python library to use the pseudo-TTY of a Docker container") | |
89 | (description "Docker PTY provides the functionality needed to operate the | |
90 | pseudo-terminal (PTY) allocated to a Docker container using the Python | |
91 | client.") | |
92 | (license license:asl2.0))) | |
df1f1d69 | 93 | |
914bba28 TGR |
94 | ;; When updating, check whether python-jsonschema-2.6 can be removed from Guix |
95 | ;; entirely. | |
df1f1d69 DT |
96 | (define-public docker-compose |
97 | (package | |
98 | (name "docker-compose") | |
99 | (version "1.5.2") | |
100 | (source | |
101 | (origin | |
102 | (method url-fetch) | |
103 | (uri (pypi-uri "docker-compose" version)) | |
104 | (sha256 | |
105 | (base32 | |
106 | "0ksg7hm2yvc977968dixxisrhcmvskzpcx3pz0v1kazrdqp7xakr")))) | |
107 | (build-system python-build-system) | |
108 | ;; TODO: Tests require running Docker daemon. | |
109 | (arguments '(#:tests? #f)) | |
110 | (inputs | |
111 | `(("python-docker-py" ,python-docker-py) | |
914bba28 | 112 | ("python-docker-pycreds" ,python-docker-pycreds) |
df1f1d69 DT |
113 | ("python-dockerpty" ,python-dockerpty) |
114 | ("python-docopt" ,python-docopt) | |
914bba28 | 115 | ("python-jsonschema" ,python-jsonschema-2.6) |
df1f1d69 DT |
116 | ("python-pyyaml" ,python-pyyaml) |
117 | ("python-requests" ,python-requests-2.7) | |
df1f1d69 DT |
118 | ("python-six" ,python-six) |
119 | ("python-texttable" ,python-texttable) | |
120 | ("python-websocket-client" ,python-websocket-client))) | |
121 | (home-page "https://www.docker.com/") | |
122 | (synopsis "Multi-container orchestration for Docker") | |
123 | (description "Docker Compose is a tool for defining and running | |
124 | multi-container Docker applications. A Compose file is used to configure an | |
125 | application’s services. Then, using a single command, the containers are | |
126 | created and all the services are started as specified in the configuration.") | |
127 | (license license:asl2.0))) | |
42531fd3 EF |
128 | |
129 | (define-public python-docker-pycreds | |
130 | (package | |
131 | (name "python-docker-pycreds") | |
d59d56b2 | 132 | (version "0.4.0") |
42531fd3 EF |
133 | (source |
134 | (origin | |
135 | (method url-fetch) | |
136 | (uri (pypi-uri "docker-pycreds" version)) | |
137 | (sha256 | |
138 | (base32 | |
d59d56b2 | 139 | "1m44smrggnqghxkqfl7vhapdw89m1p3vdr177r6cq17lr85jgqvc")))) |
42531fd3 EF |
140 | (build-system python-build-system) |
141 | (arguments | |
142 | `(#:phases | |
143 | (modify-phases %standard-phases | |
144 | (add-after 'unpack 'fix-versioning | |
145 | (lambda _ | |
146 | (substitute* "test-requirements.txt" | |
147 | (("3.0.2") ,(package-version python-pytest)) | |
148 | (("2.3.1") ,(package-version python-pytest-cov)) | |
149 | (("2.4.1") ,(package-version python-flake8))) | |
150 | #t))))) | |
151 | (native-inputs | |
152 | `(("python-flake8" ,python-flake8) | |
153 | ("python-pytest" ,python-pytest) | |
154 | ("python-pytest-cov" ,python-pytest-cov))) | |
155 | (propagated-inputs | |
156 | `(("python-six" ,python-six))) | |
157 | (home-page "https://github.com/shin-/dockerpy-creds") | |
158 | (synopsis | |
159 | "Python bindings for the Docker credentials store API") | |
160 | (description | |
161 | "Docker-Pycreds contains the Python bindings for the docker credentials | |
162 | store API. It allows programmers to interact with a Docker registry using | |
163 | Python without keeping their credentials in a Docker configuration file.") | |
164 | (license license:asl2.0))) | |
4e5b8f72 DM |
165 | |
166 | (define-public containerd | |
167 | (package | |
168 | (name "containerd") | |
a333cbf1 | 169 | (version "1.2.5") |
4e5b8f72 DM |
170 | (source |
171 | (origin | |
172 | (method git-fetch) | |
173 | (uri (git-reference | |
174 | (url "https://github.com/containerd/containerd.git") | |
175 | (commit (string-append "v" version)))) | |
176 | (file-name (git-file-name name version)) | |
177 | (sha256 | |
a333cbf1 | 178 | (base32 "0npbzixf3c0jvzm159vygvkydrr8h36c9sq50yv0mdinrys2bvg0")))) |
4e5b8f72 DM |
179 | (build-system go-build-system) |
180 | (arguments | |
181 | `(#:import-path "github.com/containerd/containerd" | |
4e5b8f72 DM |
182 | #:phases |
183 | (modify-phases %standard-phases | |
184 | (add-before 'build 'chdir | |
185 | (lambda _ | |
186 | (chdir "src/github.com/containerd/containerd") | |
187 | #t)) | |
188 | (add-after 'chdir 'patch-paths | |
189 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
190 | ;; TODO: Patch "socat", "unpigz". | |
191 | (substitute* "./runtime/v1/linux/runtime.go" | |
192 | (("defaultRuntime[ \t]*=.*") | |
193 | (string-append "defaultRuntime = \"" | |
194 | (assoc-ref inputs "runc") | |
195 | "/sbin/runc\"\n")) | |
196 | (("defaultShim[ \t]*=.*") | |
197 | (string-append "defaultShim = \"" | |
198 | (assoc-ref outputs "out") | |
199 | "/bin/containerd-shim\"\n"))) | |
200 | (substitute* "./vendor/github.com/containerd/go-runc/runc.go" | |
201 | (("DefaultCommand[ \t]*=.*") | |
202 | (string-append "DefaultCommand = \"" | |
203 | (assoc-ref inputs "runc") | |
204 | "/sbin/runc\"\n"))) | |
8b487bf8 DM |
205 | (substitute* "vendor/github.com/containerd/continuity/testutil/loopback/loopback_linux.go" |
206 | (("exec\\.Command\\(\"losetup\"") ; ) | |
207 | (string-append "exec.Command(\"" | |
208 | (assoc-ref inputs "util-linux") | |
209 | "/sbin/losetup\""))) ;) | |
4e5b8f72 DM |
210 | #t)) |
211 | (replace 'build | |
212 | (lambda* (#:key (make-flags '()) #:allow-other-keys) | |
213 | (apply invoke "make" make-flags))) | |
214 | (replace 'install | |
215 | (lambda* (#:key outputs (make-flags '()) #:allow-other-keys) | |
216 | (let* ((out (assoc-ref outputs "out"))) | |
217 | (apply invoke "make" (string-append "DESTDIR=" out) "install" | |
218 | make-flags))))))) | |
219 | (inputs | |
220 | `(("btrfs-progs" ,btrfs-progs) | |
221 | ("libseccomp" ,libseccomp) | |
8b487bf8 DM |
222 | ("runc" ,runc) |
223 | ("util-linux" ,util-linux))) | |
4e5b8f72 DM |
224 | (native-inputs |
225 | `(("go" ,go) | |
226 | ("pkg-config" ,pkg-config))) | |
40c7476a | 227 | (synopsis "Docker container runtime") |
4e5b8f72 DM |
228 | (description "This package provides the container daemon for Docker. |
229 | It includes image transfer and storage, container execution and supervision, | |
230 | network attachments.") | |
231 | (home-page "http://containerd.io/") | |
232 | (license license:asl2.0))) | |
f87ea24a | 233 | |
9c0244ab MC |
234 | ;;; Private package that shouldn't be used directly; its purposes is to be |
235 | ;;; used as a template for the various packages it contains. It doesn't build | |
236 | ;;; anyway, as it needs many dependencies that aren't being satisfied. | |
237 | (define docker-libnetwork | |
238 | ;; There are no recent release for libnetwork, so choose the last commit of | |
239 | ;; the branch that Docker uses, as can be seen in the Docker source file | |
240 | ;; 'hack/dockerfile/install/proxy.installer'. | |
241 | (let ((commit "4725f2163fb214a6312f3beae5991f838ec36326") | |
242 | (version "18.09") | |
243 | (revision "1")) | |
244 | (package | |
245 | (name "docker-libnetwork") | |
246 | (version (git-version version "1" commit)) | |
247 | (source (origin | |
248 | (method git-fetch) | |
249 | (uri (git-reference | |
250 | (url "https://github.com/docker/libnetwork.git") | |
251 | (commit commit))) | |
252 | (file-name (git-file-name name version)) | |
253 | (sha256 | |
254 | (base32 | |
255 | "1zpnxki8qfzha6ljahpwd3vkzmjhsvkmf73w6crm4ilxxw5vnpfb")) | |
256 | ;; Delete bundled ("vendored") free software source code. | |
257 | (modules '((guix build utils))) | |
258 | (snippet '(begin | |
259 | (delete-file-recursively "vendor") | |
260 | #t)))) | |
261 | (build-system go-build-system) | |
262 | (arguments | |
263 | `(#:import-path "github.com/docker/libnetwork/")) | |
264 | (home-page "https://github.com/docker/libnetwork/") | |
265 | (synopsis "Networking for containers") | |
266 | (description "Libnetwork provides a native Go implementation for | |
267 | connecting containers. The goal of @code{libnetwork} is to deliver a robust | |
268 | container network model that provides a consistent programming interface and | |
269 | the required network abstractions for applications.") | |
270 | (license license:asl2.0)))) | |
271 | ||
0b94911a MC |
272 | (define-public docker-libnetwork-cmd-proxy |
273 | (package | |
274 | (inherit docker-libnetwork) | |
275 | (name "docker-libnetwork-cmd-proxy") | |
276 | (arguments | |
277 | `(#:import-path "github.com/docker/libnetwork/cmd/proxy" | |
278 | #:unpack-path "github.com/docker/libnetwork" | |
279 | #:install-source? #f)) | |
280 | (native-inputs | |
281 | `(("go-sctp" ,go-sctp) | |
282 | ;; For tests. | |
283 | ("logrus" ,go-github-com-sirupsen-logrus) | |
284 | ("go-netlink" ,go-netlink) | |
285 | ("go-netns" ,go-netns) | |
286 | ("go-golang-org-x-crypto-ssh-terminal" | |
287 | ,go-golang-org-x-crypto-ssh-terminal) | |
288 | ("go-golang-org-x-sys-unix" ,go-golang-org-x-sys-unix))) | |
289 | (synopsis "Docker user-space proxy") | |
290 | (description "A proxy running in the user space. It is used by the | |
291 | built-in registry server of Docker.") | |
292 | (license license:asl2.0))) | |
293 | ||
516f6f55 DM |
294 | ;; TODO: Patch out modprobes for ip_vs, nf_conntrack, |
295 | ;; brige, nf_conntrack_netlink, aufs. | |
f87ea24a DM |
296 | (define-public docker |
297 | (package | |
298 | (name "docker") | |
299 | (version %docker-version) | |
300 | (source | |
301 | (origin | |
c6279326 MC |
302 | (method git-fetch) |
303 | (uri (git-reference | |
304 | (url "https://github.com/docker/engine.git") | |
305 | (commit (string-append "v" version)))) | |
306 | (file-name (git-file-name name version)) | |
307 | (sha256 | |
308 | (base32 "0cirpd9l2qazp2jyanwzvrkx2m98nksjdvn43ff38p89w6133ipb")) | |
309 | (patches | |
310 | (search-patches "docker-engine-test-noinstall.patch" | |
311 | "docker-fix-tests.patch" | |
312 | "docker-use-fewer-modprobes.patch")))) | |
f87ea24a DM |
313 | (build-system gnu-build-system) |
314 | (arguments | |
315 | `(#:modules | |
316 | ((guix build gnu-build-system) | |
317 | ((guix build go-build-system) #:prefix go:) | |
e3900a4d | 318 | (guix build union) |
f87ea24a DM |
319 | (guix build utils)) |
320 | #:imported-modules | |
321 | (,@%gnu-build-system-modules | |
e3900a4d | 322 | (guix build union) |
f87ea24a DM |
323 | (guix build go-build-system)) |
324 | #:phases | |
325 | (modify-phases %standard-phases | |
326 | (add-after 'unpack 'patch-paths | |
327 | (lambda* (#:key inputs #:allow-other-keys) | |
328 | (substitute* "builder/builder-next/executor_unix.go" | |
c6279326 MC |
329 | (("CommandCandidates:.*runc.*") |
330 | (string-append "CommandCandidates: []string{\"" | |
331 | (assoc-ref inputs "runc") | |
332 | "/sbin/runc\"},\n"))) | |
f87ea24a | 333 | (substitute* "vendor/github.com/containerd/go-runc/runc.go" |
c6279326 MC |
334 | (("DefaultCommand = .*") |
335 | (string-append "DefaultCommand = \"" | |
336 | (assoc-ref inputs "runc") | |
337 | "/sbin/runc\"\n"))) | |
f87ea24a | 338 | (substitute* "vendor/github.com/containerd/containerd/runtime/v1/linux/runtime.go" |
c6279326 MC |
339 | (("defaultRuntime[ \t]*=.*") |
340 | (string-append "defaultRuntime = \"" | |
341 | (assoc-ref inputs "runc") | |
342 | "/sbin/runc\"\n")) | |
343 | (("defaultShim[ \t]*=.*") | |
344 | (string-append "defaultShim = \"" | |
345 | (assoc-ref inputs "containerd") | |
346 | "/bin/containerd-shim\"\n"))) | |
f87ea24a | 347 | (substitute* "daemon/daemon_unix.go" |
c6279326 MC |
348 | (("DefaultShimBinary = .*") |
349 | (string-append "DefaultShimBinary = \"" | |
350 | (assoc-ref inputs "containerd") | |
351 | "/bin/containerd-shim\"\n")) | |
352 | (("DefaultRuntimeBinary = .*") | |
353 | (string-append "DefaultRuntimeBinary = \"" | |
354 | (assoc-ref inputs "runc") | |
355 | "/sbin/runc\"\n")) | |
356 | (("DefaultRuntimeName = .*") | |
357 | (string-append "DefaultRuntimeName = \"" | |
358 | (assoc-ref inputs "runc") | |
359 | "/sbin/runc\"\n"))) | |
f87ea24a | 360 | (substitute* "daemon/config/config.go" |
c6279326 MC |
361 | (("StockRuntimeName = .*") |
362 | (string-append "StockRuntimeName = \"" | |
363 | (assoc-ref inputs "runc") | |
364 | "/sbin/runc\"\n"))) | |
f87ea24a | 365 | (substitute* "vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go" |
c6279326 MC |
366 | (("var defaultCommandCandidates = .*") |
367 | (string-append "var defaultCommandCandidates = []string{\"" | |
368 | (assoc-ref inputs "runc") "/sbin/runc\"}"))) | |
80fec17f MC |
369 | (substitute* "vendor/github.com/docker/libnetwork/portmapper/proxy.go" |
370 | (("var userlandProxyCommandName = .*") | |
371 | (string-append "var userlandProxyCommandName = \"" | |
372 | (assoc-ref inputs "docker-proxy") | |
373 | "/bin/proxy\"\n"))) | |
59781b32 MC |
374 | (substitute* "pkg/archive/archive.go" |
375 | (("string\\{\"xz") | |
376 | (string-append "string{\"" (assoc-ref inputs "xz") "/bin/xz"))) | |
f87ea24a | 377 | (let ((source-files (filter (lambda (name) |
c6279326 MC |
378 | (not (string-contains name "test"))) |
379 | (find-files "." "\\.go$")))) | |
a01d54f3 MC |
380 | (let-syntax ((substitute-LookPath* |
381 | (syntax-rules () | |
382 | ((_ (source-text package relative-path) ...) | |
383 | (substitute* source-files | |
384 | (((string-append "\\<exec\\.LookPath\\(\"" | |
385 | source-text | |
386 | "\")")) | |
387 | (string-append "\"" | |
388 | (assoc-ref inputs package) | |
389 | "/" relative-path | |
390 | "\", error(nil)")) ...)))) | |
391 | (substitute-Command* | |
392 | (syntax-rules () | |
393 | ((_ (source-text package relative-path) ...) | |
394 | (substitute* source-files | |
395 | (((string-append "\\<(re)?exec\\.Command\\(\"" | |
396 | source-text | |
397 | "\"") _ re?) | |
398 | (string-append (if re? re? "") | |
399 | "exec.Command(\"" | |
400 | (assoc-ref inputs package) | |
401 | "/" relative-path | |
402 | "\"")) ...))))) | |
403 | (substitute-LookPath* | |
404 | ("ps" "procps" "bin/ps") | |
405 | ("mkfs.xfs" "xfsprogs" "bin/mkfs.xfs") | |
406 | ("lvmdiskscan" "lvm2" "sbin/lvmdiskscan") | |
407 | ("pvdisplay" "lvm2" "sbin/pvdisplay") | |
408 | ("blkid" "util-linux" "sbin/blkid") | |
409 | ("unpigz" "pigz" "bin/unpigz") | |
410 | ("iptables" "iptables" "sbin/iptables") | |
411 | ("iptables-legacy" "iptables" "sbin/iptables") | |
412 | ("ip" "iproute2" "sbin/ip")) | |
413 | ||
414 | (substitute-Command* | |
415 | ("modprobe" "kmod" "bin/modprobe") | |
416 | ("pvcreate" "lvm2" "sbin/pvcreate") | |
417 | ("vgcreate" "lvm2" "sbin/vgcreate") | |
418 | ("lvcreate" "lvm2" "sbin/lvcreate") | |
419 | ("lvconvert" "lvm2" "sbin/lvconvert") | |
420 | ("lvchange" "lvm2" "sbin/lvchange") | |
421 | ("mkfs.xfs" "xfsprogs" "sbin/mkfs.xfs") | |
422 | ("xfs_growfs" "xfsprogs" "sbin/xfs_growfs") | |
423 | ("mkfs.ext4" "e2fsprogs" "sbin/mkfs.ext4") | |
424 | ("tune2fs" "e2fsprogs" "sbin/tune2fs") | |
425 | ("blkid" "util-linux" "sbin/blkid") | |
426 | ("resize2fs" "e2fsprogs" "sbin/resize2fs") | |
427 | ("ps" "procps" "bin/ps") | |
428 | ("losetup" "util-linux" "sbin/losetup") | |
429 | ("uname" "coreutils" "bin/uname") | |
430 | ("dbus-launch" "dbus" "bin/dbus-launch") | |
431 | ("git" "git" "bin/git"))) | |
432 | ;; docker-mountfrom ?? | |
433 | ;; docker | |
434 | ;; docker-untar ?? | |
435 | ;; docker-applyLayer ?? | |
436 | ;; /usr/bin/uname | |
437 | ;; grep | |
438 | ;; apparmor_parser | |
439 | ||
65a7e35c DM |
440 | ;; Make compilation fail when, in future versions, Docker |
441 | ;; invokes other programs we don't know about and thus don't | |
442 | ;; substitute. | |
443 | (substitute* source-files | |
c6279326 | 444 | ;; Search for Java in PATH. |
1b14e1bc MC |
445 | (("\\<exec\\.Command\\(\"java\"") |
446 | "xxec.Command(\"java\"") | |
c6279326 | 447 | ;; Search for AUFS in PATH (mainline Linux doesn't support it). |
1b14e1bc MC |
448 | (("\\<exec\\.Command\\(\"auplink\"") |
449 | "xxec.Command(\"auplink\"") | |
c6279326 MC |
450 | ;; Fail on other unsubstituted commands. |
451 | (("\\<exec\\.Command\\(\"([a-zA-Z0-9][a-zA-Z0-9_-]*)\"" | |
1b14e1bc | 452 | _ executable) |
c6279326 | 453 | (string-append "exec.Guix_doesnt_want_Command(\"" |
1b14e1bc | 454 | executable "\"")) |
c6279326 MC |
455 | (("\\<xxec\\.Command") |
456 | "exec.Command") | |
457 | ;; Search for ZFS in PATH. | |
458 | (("\\<LookPath\\(\"zfs\"\\)") "LooxPath(\"zfs\")") | |
459 | ;; Fail on other unsubstituted LookPaths. | |
1b14e1bc | 460 | (("\\<LookPath\\(\"") "Guix_doesnt_want_LookPath\\(\"") |
c6279326 | 461 | (("\\<LooxPath") "LookPath"))) |
f87ea24a DM |
462 | #t)) |
463 | (add-after 'patch-paths 'delete-failing-tests | |
464 | (lambda _ | |
465 | ;; Needs internet access. | |
466 | (delete-file "builder/remotecontext/git/gitutils_test.go") | |
467 | ;; Permission denied. | |
468 | (delete-file "daemon/graphdriver/devmapper/devmapper_test.go") | |
469 | ;; Operation not permitted (idtools.MkdirAllAndChown). | |
470 | (delete-file "daemon/graphdriver/vfs/vfs_test.go") | |
471 | ;; Timeouts after 5 min. | |
472 | (delete-file "plugin/manager_linux_test.go") | |
8cd95860 | 473 | ;; Operation not permitted. |
74bf1b5d | 474 | (delete-file "daemon/graphdriver/btrfs/btrfs_test.go") |
8cd95860 DM |
475 | (delete-file "daemon/graphdriver/overlay/overlay_test.go") |
476 | (delete-file "daemon/graphdriver/overlay2/overlay_test.go") | |
f87ea24a DM |
477 | #t)) |
478 | (replace 'configure | |
479 | (lambda _ | |
480 | (setenv "DOCKER_GITCOMMIT" (string-append "v" ,%docker-version)) | |
481 | ;; Automatically use bundled dependencies. | |
482 | ;; TODO: Unbundle - see file "vendor.conf". | |
483 | (setenv "AUTO_GOPATH" "1") | |
484 | ;; Respectively, strip the symbol table and debug | |
485 | ;; information, and the DWARF symbol table. | |
486 | (setenv "LDFLAGS" "-s -w") | |
487 | ;; Make build faster | |
488 | (setenv "GOCACHE" "/tmp") | |
489 | #t)) | |
e3900a4d LF |
490 | (add-before 'build 'setup-go-environment |
491 | (assoc-ref go:%standard-phases 'setup-go-environment)) | |
f87ea24a DM |
492 | (replace 'build |
493 | (lambda _ | |
494 | ;; Our LD doesn't like the statically linked relocatable things | |
495 | ;; that go produces, so install the dynamic version of | |
496 | ;; dockerd instead. | |
497 | (invoke "hack/make.sh" "dynbinary"))) | |
498 | (replace 'check | |
499 | (lambda _ | |
500 | ;; The build process generated a file because the environment | |
501 | ;; variable "AUTO_GOPATH" was set. Use it. | |
502 | (setenv "GOPATH" (string-append (getcwd) "/.gopath")) | |
503 | ;; ".gopath/src/github.com/docker/docker" is a link to the current | |
504 | ;; directory and chdir would canonicalize to that. | |
505 | ;; But go needs to have the uncanonicalized directory name, so | |
506 | ;; store that. | |
507 | (setenv "PWD" (string-append (getcwd) | |
c6279326 | 508 | "/.gopath/src/github.com/docker/docker")) |
f87ea24a DM |
509 | (with-directory-excursion ".gopath/src/github.com/docker/docker" |
510 | (invoke "hack/test/unit")) | |
511 | (setenv "PWD" #f) | |
512 | #t)) | |
513 | (replace 'install | |
514 | (lambda* (#:key outputs #:allow-other-keys) | |
515 | (let* ((out (assoc-ref outputs "out")) | |
516 | (out-bin (string-append out "/bin"))) | |
517 | (install-file "bundles/dynbinary-daemon/dockerd" out-bin) | |
518 | (install-file "bundles/dynbinary-daemon/dockerd-dev" out-bin) | |
519 | #t)))))) | |
520 | (inputs | |
521 | `(("btrfs-progs" ,btrfs-progs) | |
c6279326 | 522 | ("containerd" ,containerd) ; for containerd-shim |
58adcaa1 | 523 | ("coreutils" ,coreutils) |
6b6a25d4 | 524 | ("dbus" ,dbus) |
80fec17f | 525 | ("docker-proxy" ,docker-libnetwork-cmd-proxy) |
58adcaa1 | 526 | ("e2fsprogs" ,e2fsprogs) |
6b6a25d4 | 527 | ("git" ,git) |
f87ea24a DM |
528 | ("iproute2" ,iproute) |
529 | ("iptables" ,iptables) | |
58adcaa1 | 530 | ("kmod" ,kmod) |
f87ea24a DM |
531 | ("libseccomp" ,libseccomp) |
532 | ("pigz" ,pigz) | |
533 | ("procps" ,procps) | |
58adcaa1 | 534 | ("runc" ,runc) |
f87ea24a DM |
535 | ("util-linux" ,util-linux) |
536 | ("lvm2" ,lvm2) | |
59781b32 MC |
537 | ("xfsprogs" ,xfsprogs) |
538 | ("xz" ,xz))) | |
f87ea24a | 539 | (native-inputs |
c6279326 | 540 | `(("eudev" ,eudev) ; TODO: Should be propagated by lvm2 (.pc -> .pc) |
f87ea24a DM |
541 | ("go" ,go) |
542 | ("pkg-config" ,pkg-config))) | |
543 | (synopsis "Docker container component library, and daemon") | |
544 | (description "This package provides a framework to assemble specialized | |
545 | container systems. It includes components for orchestration, image | |
546 | management, secret management, configuration management, networking, | |
547 | provisioning etc.") | |
548 | (home-page "https://mobyproject.org/") | |
549 | (license license:asl2.0))) | |
e9b31645 DM |
550 | |
551 | (define-public docker-cli | |
552 | (package | |
553 | (name "docker-cli") | |
554 | (version %docker-version) | |
555 | (source | |
556 | (origin | |
557 | (method git-fetch) | |
558 | (uri (git-reference | |
559 | (url "https://github.com/docker/cli.git") | |
560 | (commit (string-append "v" version)))) | |
561 | (file-name (git-file-name name version)) | |
562 | (sha256 | |
0e84987f | 563 | (base32 "0mxxjzkwdny8p2dmyjich7x1gn7hdlfppzjy2skk2k5bwv7nxpmi")))) |
e9b31645 DM |
564 | (build-system go-build-system) |
565 | (arguments | |
566 | `(#:import-path "github.com/docker/cli" | |
567 | ;; TODO: Tests require a running Docker daemon. | |
568 | #:tests? #f | |
569 | #:phases | |
570 | (modify-phases %standard-phases | |
571 | (add-before 'build 'setup-environment-2 | |
572 | (lambda _ | |
573 | ;; Respectively, strip the symbol table and debug | |
574 | ;; information, and the DWARF symbol table. | |
575 | (setenv "LDFLAGS" "-s -w") | |
576 | ||
577 | ;; Make build reproducible. | |
578 | (setenv "BUILDTIME" "1970-01-01 00:00:01.000000000+00:00") | |
579 | (symlink "src/github.com/docker/cli/scripts" "./scripts") | |
580 | (symlink "src/github.com/docker/cli/docker.Makefile" "./docker.Makefile") | |
581 | #t)) | |
582 | (replace 'build | |
583 | (lambda _ | |
584 | (invoke "./scripts/build/dynbinary"))) | |
585 | (replace 'check | |
586 | (lambda* (#:key make-flags tests? #:allow-other-keys) | |
587 | (setenv "PATH" (string-append (getcwd) "/build:" (getenv "PATH"))) | |
588 | (if tests? | |
589 | ;; Use the newly-built docker client for the tests. | |
590 | (with-directory-excursion "src/github.com/docker/cli" | |
591 | ;; TODO: Run test-e2e as well? | |
592 | (apply invoke "make" "-f" "docker.Makefile" "test-unit" | |
593 | (or make-flags '()))) | |
594 | #t))) | |
595 | (replace 'install | |
596 | (lambda* (#:key outputs #:allow-other-keys) | |
597 | (let* ((out (assoc-ref outputs "out")) | |
598 | (out-bin (string-append out "/bin"))) | |
599 | (chdir "build") | |
e9b31645 DM |
600 | (install-file "docker" out-bin) |
601 | #t)))))) | |
602 | (native-inputs | |
603 | `(("go" ,go) | |
604 | ("libltdl" ,libltdl) | |
605 | ("pkg-config" ,pkg-config))) | |
606 | (synopsis "Command line interface to Docker") | |
607 | (description "This package provides a command line interface to Docker.") | |
17d25019 | 608 | (home-page "https://www.docker.com/") |
e9b31645 | 609 | (license license:asl2.0))) |
975a953b MC |
610 | |
611 | (define-public cqfd | |
612 | (package | |
613 | (name "cqfd") | |
112fd34f | 614 | (version "5.1.0") |
975a953b MC |
615 | (source (origin |
616 | (method git-fetch) | |
617 | (uri (git-reference | |
618 | (url "https://github.com/savoirfairelinux/cqfd.git") | |
619 | (commit (string-append "v" version)))) | |
620 | (file-name (git-file-name name version)) | |
621 | (sha256 | |
622 | (base32 | |
112fd34f | 623 | "1xhydz01f2rrnw7rmnaxh3f3q1ariq7j2ig0i0w1p3wn10l3q0nv")))) |
975a953b MC |
624 | (build-system gnu-build-system) |
625 | (arguments | |
626 | ;; The test suite requires a docker daemon and connectivity. | |
627 | `(#:tests? #f | |
628 | #:phases | |
629 | (modify-phases %standard-phases | |
630 | (delete 'configure) | |
631 | (delete 'build) | |
632 | (replace 'install | |
633 | (lambda* (#:key outputs #:allow-other-keys) | |
634 | (let ((out (assoc-ref outputs "out"))) | |
635 | ;; Fix the directory of the bash completion. | |
636 | (substitute* "Makefile" | |
637 | (("completionsdir=.*$") | |
638 | (string-append "completionsdir=" out | |
639 | "/etc/bash_completion.d; \\\n"))) | |
640 | (invoke "make" "install" | |
641 | (string-append "PREFIX=" out)))))))) | |
642 | (home-page "https://github.com/savoirfairelinux/cqfd") | |
643 | (synopsis "Convenience wrapper for Docker") | |
644 | (description "cqfd is a Bash script that provides a quick and convenient | |
112fd34f | 645 | way to run commands in the current directory, but within a Docker container |
975a953b MC |
646 | defined in a per-project configuration file.") |
647 | (license license:gpl3+))) |