gnu: guix: Cross-build fixup for wrap-program.
[jackhill/guix/guix.git] / gnu / packages / package-management.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2017, 2020 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2017 Muriithi Frederick Muriuki <fredmanglis@gmail.com>
5 ;;; Copyright © 2017, 2018 Oleg Pykhalov <go.wigust@gmail.com>
6 ;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
7 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
9 ;;; Copyright © 2018, 2019 Rutger Helling <rhelling@mykolab.com>
10 ;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
11 ;;; Copyright © 2018, 2019 Eric Bavier <bavier@member.fsf.org>
12 ;;; Copyright © 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
13 ;;; Copyright © 2019 Jonathan Brielmaier <jonathan.brielmaier@web.de>
14 ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
15 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
16 ;;;
17 ;;; This file is part of GNU Guix.
18 ;;;
19 ;;; GNU Guix is free software; you can redistribute it and/or modify it
20 ;;; under the terms of the GNU General Public License as published by
21 ;;; the Free Software Foundation; either version 3 of the License, or (at
22 ;;; your option) any later version.
23 ;;;
24 ;;; GNU Guix is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;;; GNU General Public License for more details.
28 ;;;
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32 (define-module (gnu packages package-management)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages acl)
35 #:use-module (gnu packages attr)
36 #:use-module (gnu packages avahi)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages backup)
39 #:use-module (gnu packages base)
40 #:use-module (gnu packages bash)
41 #:use-module (gnu packages bdw-gc)
42 #:use-module (gnu packages bison)
43 #:use-module (gnu packages bootstrap) ;for 'bootstrap-guile-origin'
44 #:use-module (gnu packages check)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages cpio)
47 #:use-module (gnu packages crypto)
48 #:use-module (gnu packages curl)
49 #:use-module (gnu packages dbm)
50 #:use-module (gnu packages docbook)
51 #:use-module (gnu packages file)
52 #:use-module (gnu packages gettext)
53 #:use-module (gnu packages glib)
54 #:use-module (gnu packages gnome)
55 #:use-module (gnu packages gnupg)
56 #:use-module (gnu packages graphviz)
57 #:use-module (gnu packages gtk)
58 #:use-module (gnu packages guile)
59 #:use-module (gnu packages guile-xyz)
60 #:use-module (gnu packages linux)
61 #:use-module (gnu packages lisp)
62 #:use-module (gnu packages man)
63 #:use-module (gnu packages nettle)
64 #:use-module (gnu packages nss)
65 #:use-module (gnu packages patchutils)
66 #:use-module (gnu packages perl)
67 #:use-module (gnu packages perl-check)
68 #:use-module (gnu packages pkg-config)
69 #:use-module (gnu packages popt)
70 #:use-module (gnu packages python)
71 #:use-module (gnu packages python-web)
72 #:use-module (gnu packages python-xyz)
73 #:use-module (gnu packages serialization)
74 #:use-module (gnu packages sqlite)
75 #:use-module (gnu packages ssh)
76 #:use-module (gnu packages texinfo)
77 #:use-module (gnu packages time)
78 #:use-module (gnu packages tls)
79 #:use-module (gnu packages vim)
80 #:use-module (gnu packages virtualization)
81 #:use-module (gnu packages web)
82 #:use-module (gnu packages xml)
83 #:use-module (gnu packages xorg)
84 #:use-module (guix build-system glib-or-gtk)
85 #:use-module (guix build-system gnu)
86 #:use-module (guix build-system meson)
87 #:use-module (guix build-system python)
88 #:use-module (guix download)
89 #:use-module (guix gexp)
90 #:use-module (guix git-download)
91 #:use-module ((guix licenses) #:prefix license:)
92 #:use-module (guix packages)
93 #:use-module (guix utils)
94 #:use-module (ice-9 match)
95 #:use-module (srfi srfi-1))
96
97 (define (boot-guile-uri arch)
98 "Return the URI for the bootstrap Guile tarball for ARCH."
99 (cond ((string=? "armhf" arch)
100 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
101 arch "-linux"
102 "/20150101/guile-2.0.11.tar.xz"))
103 ((string=? "aarch64" arch)
104 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
105 arch "-linux/20170217/guile-2.0.14.tar.xz"))
106 (else
107 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
108 arch "-linux"
109 "/20131110/guile-2.0.9.tar.xz"))))
110
111 (define-public guix
112 ;; Latest version of Guix, which may or may not correspond to a release.
113 ;; Note: the 'update-guix-package.scm' script expects this definition to
114 ;; start precisely like this.
115 (let ((version "1.1.0")
116 (commit "619f9181a363576894a433206008b139255062dd")
117 (revision 2))
118 (package
119 (name "guix")
120
121 (version (if (zero? revision)
122 version
123 (string-append version "-"
124 (number->string revision)
125 "." (string-take commit 7))))
126 (source (origin
127 (method git-fetch)
128 (uri (git-reference
129 (url "https://git.savannah.gnu.org/r/guix.git")
130 (commit commit)))
131 (sha256
132 (base32
133 "1lk0h9zgry7m78nv70gxwb57pw1d5yzay477gxsc43v1aa7zg8sp"))
134 (file-name (string-append "guix-" version "-checkout"))))
135 (build-system gnu-build-system)
136 (arguments
137 `(#:configure-flags (list
138 "--localstatedir=/var"
139 "--sysconfdir=/etc"
140 (string-append "--with-bash-completion-dir="
141 (assoc-ref %outputs "out")
142 "/etc/bash_completion.d")
143
144 ;; Set 'DOT_USER_PROGRAM' to the empty string so
145 ;; we don't keep a reference to Graphviz, whose
146 ;; closure is pretty big (too big for the Guix
147 ;; system installation image.)
148 "ac_cv_path_DOT_USER_PROGRAM=dot"
149
150 ;; To avoid problems with the length of shebangs,
151 ;; choose a fixed-width and short directory name
152 ;; for tests.
153 "ac_cv_guix_test_root=/tmp/guix-tests")
154 #:parallel-tests? #f ;work around <http://bugs.gnu.org/21097>
155
156 #:modules ((guix build gnu-build-system)
157 (guix build utils)
158 (srfi srfi-26)
159 (ice-9 popen)
160 (ice-9 rdelim))
161
162 #:phases (modify-phases %standard-phases
163 (replace 'bootstrap
164 (lambda _
165 ;; Make sure 'msgmerge' can modify the PO files.
166 (for-each (lambda (po)
167 (chmod po #o666))
168 (find-files "." "\\.po$"))
169
170 (patch-shebang "build-aux/git-version-gen")
171
172 (call-with-output-file ".tarball-version"
173 (lambda (port)
174 (display ,version port)))
175
176 ;; Install SysV init files to $(prefix)/etc rather
177 ;; than to /etc.
178 (substitute* "nix/local.mk"
179 (("^sysvinitservicedir = .*$")
180 (string-append "sysvinitservicedir = \
181 $(prefix)/etc/init.d\n")))
182
183 (invoke "sh" "bootstrap")))
184 (add-before 'build 'use-host-compressors
185 (lambda* (#:key inputs target #:allow-other-keys)
186 (when target
187 ;; Use host compressors.
188 (let ((bzip2 (assoc-ref inputs "bzip2"))
189 (gzip (assoc-ref inputs "gzip"))
190 (xz (assoc-ref inputs "xz")))
191 (substitute* "guix/config.scm"
192 (("\"[^\"]*/bin/bzip2")
193 (string-append "\"" bzip2 "/bin/bzip2"))
194 (("\"[^\"]*/bin/gzip") gzip
195 (string-append "\"" gzip "/bin/gzip"))
196 (("\"[^\"]*/bin//xz")
197 (string-append "\"" xz "/bin/xz")))))
198 #t))
199 (add-before 'check 'copy-bootstrap-guile
200 (lambda* (#:key system target inputs #:allow-other-keys)
201 ;; Copy the bootstrap guile tarball in the store
202 ;; used by the test suite.
203 (define (intern file recursive?)
204 ;; Note: don't use 'guix download' here because we
205 ;; need to set the 'recursive?' argument.
206 (define base
207 (strip-store-file-name file))
208
209 (define code
210 `(begin
211 (use-modules (guix))
212 (with-store store
213 (let* ((item (add-to-store store ,base
214 ,recursive?
215 "sha256" ,file))
216 (root (string-append "/tmp/gc-root-"
217 (basename item))))
218 ;; Register a root so that the GC tests
219 ;; don't delete those.
220 (symlink item root)
221 (add-indirect-root store root)))))
222
223 (invoke "./test-env" "guile" "-c"
224 (object->string code)))
225
226 (unless target
227 (intern (assoc-ref inputs "boot-guile") #f)
228
229 ;; On x86_64 some tests need the i686 Guile.
230 ,@(if (and (not (%current-target-system))
231 (string=? (%current-system)
232 "x86_64-linux"))
233 '((intern (assoc-ref inputs "boot-guile/i686") #f))
234 '())
235
236 ;; Copy the bootstrap executables.
237 (for-each (lambda (input)
238 (intern (assoc-ref inputs input) #t))
239 '("bootstrap/bash" "bootstrap/mkdir"
240 "bootstrap/tar" "bootstrap/xz")))
241 #t))
242 (add-after 'unpack 'disable-failing-tests
243 ;; XXX FIXME: These tests fail within the build container.
244 (lambda _
245 (substitute* "tests/syscalls.scm"
246 (("^\\(test-(assert|equal) \"(clone|setns|pivot-root)\"" all)
247 (string-append "(test-skip 1)\n" all)))
248 (substitute* "tests/containers.scm"
249 (("^\\(test-(assert|equal)" all)
250 (string-append "(test-skip 1)\n" all)))
251 (when (file-exists? "tests/guix-environment-container.sh")
252 (substitute* "tests/guix-environment-container.sh"
253 (("guix environment --version")
254 "exit 77\n")))
255 #t))
256 (add-before 'check 'set-SHELL
257 (lambda _
258 ;; 'guix environment' tests rely on 'SHELL' having a
259 ;; correct value, so set it.
260 (setenv "SHELL" (which "sh"))
261 #t))
262 (add-after 'install 'wrap-program
263 (lambda* (#:key inputs native-inputs outputs target
264 #:allow-other-keys)
265 ;; Make sure the 'guix' command finds GnuTLS,
266 ;; Guile-JSON, and Guile-Git automatically.
267 (let* ((out (assoc-ref outputs "out"))
268 (guile ,@(if (%current-target-system)
269 '((assoc-ref native-inputs "guile"))
270 '((assoc-ref inputs "guile"))))
271 (gcrypt (assoc-ref inputs "guile-gcrypt"))
272 (json (assoc-ref inputs "guile-json"))
273 (sqlite (assoc-ref inputs "guile-sqlite3"))
274 (git (assoc-ref inputs "guile-git"))
275 (bs (assoc-ref inputs
276 "guile-bytestructures"))
277 (ssh (assoc-ref inputs "guile-ssh"))
278 (gnutls (assoc-ref inputs "gnutls"))
279 (locales (assoc-ref inputs "glibc-utf8-locales"))
280 (deps (list gcrypt json sqlite gnutls
281 git bs ssh))
282 (effective
283 (read-line
284 (open-pipe* OPEN_READ
285 (string-append guile "/bin/guile")
286 "-c" "(display (effective-version))")))
287 (path (string-join
288 (map (cut string-append <>
289 "/share/guile/site/"
290 effective)
291 (delete #f deps))
292 ":"))
293 (gopath (string-join
294 (map (cut string-append <>
295 "/lib/guile/" effective
296 "/site-ccache")
297 (delete #f deps))
298 ":"))
299 (locpath (string-append locales "/lib/locale")))
300
301 (wrap-program (string-append out "/bin/guix")
302 `("GUILE_LOAD_PATH" ":" prefix (,path))
303 `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,gopath))
304 `("GUIX_LOCPATH" ":" suffix (,locpath)))
305
306 (when target
307 ;; XXX Touching wrap-program rebuilds world
308 (let ((bash (assoc-ref inputs "bash")))
309 (substitute* (string-append out "/bin/guix")
310 (("^#!.*/bash") (string-append "#! " bash "/bin/bash")))))
311 #t))))))
312 (native-inputs `(("pkg-config" ,pkg-config)
313
314 ;; Guile libraries are needed here for
315 ;; cross-compilation.
316 ("guile" ,guile-3.0)
317 ("gnutls" ,gnutls)
318 ("guile-gcrypt" ,guile-gcrypt)
319 ("guile-json" ,guile-json-3)
320 ("guile-sqlite3" ,guile-sqlite3)
321 ("guile-ssh" ,guile-ssh)
322 ("guile-git" ,guile-git)
323
324 ;; XXX: Keep the development inputs here even though
325 ;; they're unnecessary, just so that 'guix environment
326 ;; guix' always contains them.
327 ("autoconf" ,autoconf-wrapper)
328 ("automake" ,automake)
329 ("gettext" ,gettext-minimal)
330 ("texinfo" ,texinfo)
331 ("graphviz" ,graphviz)
332 ("help2man" ,help2man)
333 ("po4a" ,po4a)))
334 (inputs
335 `(("bzip2" ,bzip2)
336 ("gzip" ,gzip)
337 ("zlib" ,zlib) ;for 'guix publish'
338 ("lzlib" ,lzlib) ;for 'guix publish' and 'guix substitute'
339
340 ("sqlite" ,sqlite)
341 ("libgcrypt" ,libgcrypt)
342
343 ("guile" ,guile-3.0)
344
345 ;; Some of the tests use "unshare" when it is available.
346 ("util-linux" ,util-linux)
347
348 ;; Many tests rely on the 'guile-bootstrap' package, which is why we
349 ;; have it here.
350 ("boot-guile" ,(bootstrap-guile-origin (%current-system)))
351 ,@(if (and (not (%current-target-system))
352 (string=? (%current-system) "x86_64-linux"))
353 `(("boot-guile/i686" ,(bootstrap-guile-origin "i686-linux")))
354 '())
355 ,@(if (%current-target-system)
356 `(("bash" ,bash-minimal)
357 ("xz" ,xz))
358 '())
359
360 ;; Tests also rely on these bootstrap executables.
361 ("bootstrap/bash" ,(bootstrap-executable "bash" (%current-system)))
362 ("bootstrap/mkdir" ,(bootstrap-executable "mkdir" (%current-system)))
363 ("bootstrap/tar" ,(bootstrap-executable "tar" (%current-system)))
364 ("bootstrap/xz" ,(bootstrap-executable "xz" (%current-system)))
365
366 ("glibc-utf8-locales" ,glibc-utf8-locales)))
367 (propagated-inputs
368 `(("gnutls" ,(if (%current-target-system) gnutls-3.6.13 guile3.0-gnutls))
369 ("guile-gcrypt" ,guile-gcrypt)
370 ("guile-json" ,guile-json-3)
371 ("guile-sqlite3" ,guile-sqlite3)
372 ("guile-ssh" ,guile-ssh)
373 ("guile-git" ,guile-git)))
374
375 (home-page "https://www.gnu.org/software/guix/")
376 (synopsis "Functional package manager for installed software packages and versions")
377 (description
378 "GNU Guix is a functional package manager for the GNU system, and is
379 also a distribution thereof. It includes a virtual machine image. Besides
380 the usual package management features, it also supports transactional
381 upgrades and roll-backs, per-user profiles, and much more. It is based on
382 the Nix package manager.")
383 (license license:gpl3+)
384 (properties '((ftp-server . "alpha.gnu.org"))))))
385
386 (define-public guix-daemon
387 ;; This package is for internal consumption: it allows us to quickly build
388 ;; the 'guix-daemon' program and use that in (guix self), used by 'guix
389 ;; pull'.
390 (package
391 (inherit guix)
392 (properties `((hidden? . #t)))
393 (name "guix-daemon")
394
395 ;; Use a minimum set of dependencies.
396 (native-inputs
397 (fold alist-delete (package-native-inputs guix)
398 '("po4a" "graphviz" "help2man")))
399 (inputs
400 `(("gnutls" ,guile3.0-gnutls)
401 ("guile-git" ,guile-git)
402 ("guile-json" ,guile-json-3)
403 ("guile-gcrypt" ,guile-gcrypt)
404 ,@(fold alist-delete (package-inputs guix)
405 '("boot-guile" "boot-guile/i686" "util-linux"))))
406
407 (propagated-inputs '())
408
409 (arguments
410 (substitute-keyword-arguments (package-arguments guix)
411 ((#:configure-flags flags '())
412 ;; Pretend we have those libraries; we don't actually need them.
413 `(append ,flags
414 '("guix_cv_have_recent_guile_sqlite3=yes"
415 "guix_cv_have_recent_guile_ssh=yes")))
416 ((#:tests? #f #f)
417 #f)
418 ((#:phases phases '%standard-phases)
419 `(modify-phases ,phases
420 (add-after 'unpack 'change-default-guix
421 (lambda _
422 ;; We need to tell 'guix-daemon' which 'guix' command to use.
423 ;; Here we use a questionable hack where we hard-code root's
424 ;; current guix, which could be wrong (XXX). Note that scripts
425 ;; like 'guix perform-download' do not run as root so we assume
426 ;; that they have access to /var/guix/profiles/per-user/root.
427 (substitute* "nix/libstore/globals.cc"
428 (("guixProgram = (.*)nixBinDir + \"/guix\"" _ before)
429 (string-append "guixProgram = " before
430 "/var/guix/profiles/per-user/root\
431 /current-guix/bin/guix")))
432 #t))
433 (replace 'build
434 (lambda _
435 (invoke "make" "nix/libstore/schema.sql.hh")
436 (invoke "make" "-j" (number->string
437 (parallel-job-count))
438 "guix-daemon")))
439 (delete 'copy-bootstrap-guile)
440 (replace 'install
441 (lambda* (#:key outputs #:allow-other-keys)
442 (invoke "make" "install-binPROGRAMS")))
443 (delete 'wrap-program)))))))
444
445
446 (define-public guile2.2-guix
447 (package
448 (inherit guix)
449 (name "guile2.2-guix")
450 (native-inputs
451 `(("guile" ,guile-2.2)
452 ("gnutls" ,guile2.2-gnutls)
453 ("guile-gcrypt" ,guile2.2-gcrypt)
454 ("guile-json" ,guile2.2-json)
455 ("guile-sqlite3" ,guile2.2-sqlite3)
456 ("guile-ssh" ,guile2.2-ssh)
457 ("guile-git" ,guile2.2-git)
458 ,@(fold alist-delete (package-native-inputs guix)
459 '("guile" "gnutls" "guile-gcrypt" "guile-json"
460 "guile-sqlite3" "guile-ssh" "guile-git"))))
461 (inputs
462 `(("guile" ,guile-2.2)
463 ,@(alist-delete "guile" (package-inputs guix))))
464 (propagated-inputs
465 `(("gnutls" ,gnutls)
466 ("guile-gcrypt" ,guile2.2-gcrypt)
467 ("guile-json" ,guile2.2-json)
468 ("guile-sqlite3" ,guile2.2-sqlite3)
469 ("guile-ssh" ,guile2.2-ssh)
470 ("guile-git" ,guile2.2-git)))))
471
472 (define-public guile3.0-guix
473 (deprecated-package "guile3.0-guix" guix))
474
475 (define-public guix-minimal
476 ;; A version of Guix which is built with the minimal set of dependencies, as
477 ;; outlined in the README "Requirements" section. Intended as a CI job, so
478 ;; marked as hidden.
479 (hidden-package
480 (package
481 (inherit guix)
482 (name "guix-minimal")
483 (inputs
484 `(("guile" ,guile-2.2)
485 ,@(alist-delete "guile" (package-inputs guix))))
486 (propagated-inputs
487 (fold alist-delete
488 (package-propagated-inputs guix)
489 '("guile-ssh"))))))
490
491 (define (source-file? file stat)
492 "Return true if FILE is likely a source file, false if it is a typical
493 generated file."
494 (define (wrong-extension? file)
495 (or (string-suffix? "~" file)
496 (member (file-extension file)
497 '("o" "a" "lo" "so" "go"))))
498
499 (match (basename file)
500 ((or ".git" "autom4te.cache" "configure" "Makefile" "Makefile.in" ".libs")
501 #f)
502 ((? wrong-extension?)
503 #f)
504 (_
505 #t)))
506
507 (define-public current-guix-package
508 ;; This parameter allows callers to override the package that 'current-guix'
509 ;; returns. This is useful when 'current-guix' cannot compute it by itself,
510 ;; for instance because it's not running from a source code checkout.
511 (make-parameter #f))
512
513 (define-public current-guix
514 (let* ((repository-root (delay (canonicalize-path
515 (string-append (current-source-directory)
516 "/../.."))))
517 (select? (delay (or (git-predicate (force repository-root))
518 source-file?))))
519 (lambda ()
520 "Return a package representing Guix built from the current source tree.
521 This works by adding the current source tree to the store (after filtering it
522 out) and returning a package that uses that as its 'source'."
523 (or (current-guix-package)
524 (package
525 (inherit guix)
526 (version (string-append (package-version guix) "+"))
527 (source (local-file (force repository-root) "guix-current"
528 #:recursive? #t
529 #:select? (force select?))))))))
530
531 \f
532 ;;;
533 ;;; Other tools.
534 ;;;
535
536 (define-public nix
537 (package
538 (name "nix")
539 (version "2.0.4")
540 (source (origin
541 (method url-fetch)
542 (uri (string-append "http://nixos.org/releases/nix/nix-"
543 version "/nix-" version ".tar.xz"))
544 (sha256
545 (base32
546 "0ss9svxlh1pvrdmnqjvjyqjmbqmrdbyfarvbb14i9d4bggzl0r8n"))))
547 (build-system gnu-build-system)
548 (native-inputs `(("pkg-config" ,pkg-config)))
549 (inputs `(("curl" ,curl)
550 ("bzip2" ,bzip2)
551 ("libgc" ,libgc)
552 ("libseccomp" ,libseccomp)
553 ("libsodium" ,libsodium)
554 ("openssl" ,openssl)
555 ("sqlite" ,sqlite)
556 ("xz" ,xz)))
557 (home-page "https://nixos.org/nix/")
558 (synopsis "The Nix package manager")
559 (description
560 "Nix is a purely functional package manager. This means that it treats
561 packages like values in purely functional programming languages such as
562 Haskell—they are built by functions that don't have side-effects, and they
563 never change after they have been built. Nix stores packages in the Nix
564 store, usually the directory /nix/store, where each package has its own unique
565 sub-directory.")
566 (license license:lgpl2.1+)))
567
568 (define-public stow
569 (package
570 (name "stow")
571 (version "2.3.1")
572 (source (origin
573 (method url-fetch)
574 (uri (string-append "mirror://gnu/stow/stow-"
575 version ".tar.gz"))
576 (sha256
577 (base32
578 "0jrxy12ywn7smdzdnvwzjw77l6knx6jkj2rckgykg1dpf6bdkm89"))))
579 (build-system gnu-build-system)
580 (inputs
581 `(("perl" ,perl)))
582 (native-inputs
583 `(("perl-test-simple" ,perl-test-simple)
584 ("perl-test-output" ,perl-test-output)
585 ("perl-capture-tiny" ,perl-capture-tiny)
586 ("perl-io-stringy" ,perl-io-stringy)))
587 (home-page "https://www.gnu.org/software/stow/")
588 (synopsis "Managing installed software packages")
589 (description
590 "GNU Stow is a symlink manager. It generates symlinks to directories
591 of data and makes them appear to be merged into the same directory. It is
592 typically used for managing software packages installed from source, by
593 letting you install them apart in distinct directories and then create
594 symlinks to the files in a common directory such as /usr/local.")
595 (license license:gpl3+)))
596
597 (define-public rpm
598 (package
599 (name "rpm")
600 (version "4.14.2.1")
601 (source (origin
602 (method url-fetch)
603 (uri (string-append "http://ftp.rpm.org/releases/rpm-"
604 (version-major+minor version) ".x/rpm-"
605 version ".tar.bz2"))
606 (sha256
607 (base32
608 "1nmck2fq9h85fgs3zhh6w1avlw5y16cbz5khd459ry3jfd5w4f8i"))))
609 (build-system gnu-build-system)
610 (arguments
611 '(#:configure-flags '("--with-external-db" ;use the system's bdb
612 "--enable-python"
613 "--without-lua")
614 #:phases (modify-phases %standard-phases
615 (add-before 'configure 'set-nss-library-path
616 (lambda* (#:key inputs #:allow-other-keys)
617 (let ((nss (assoc-ref inputs "nss")))
618 (setenv "LIBRARY_PATH"
619 (string-append (getenv "LIBRARY_PATH") ":"
620 nss "/lib/nss"))
621 #t))))))
622 (native-inputs
623 `(("pkg-config" ,pkg-config)))
624 (inputs
625 `(("python" ,python)
626 ("xz" ,xz)
627 ("bdb" ,bdb)
628 ("popt" ,popt)
629 ("nss" ,nss)
630 ("nspr" ,nspr)
631 ("libarchive" ,libarchive)
632 ("file" ,file)
633 ("bzip2" ,bzip2)
634 ("zlib" ,zlib)
635 ("cpio" ,cpio)))
636 (home-page "https://rpm.org/")
637 (synopsis "The RPM Package Manager")
638 (description
639 "The RPM Package Manager (RPM) is a command-line driven package
640 management system capable of installing, uninstalling, verifying, querying,
641 and updating computer software packages. Each software package consists of an
642 archive of files along with information about the package like its version, a
643 description. There is also a library permitting developers to manage such
644 transactions from C or Python.")
645
646 ;; The whole is GPLv2+; librpm itself is dual-licensed LGPLv2+ | GPLv2+.
647 (license license:gpl2+)))
648
649 (define-public python-anaconda-client
650 (package
651 (name "python-anaconda-client")
652 (version "1.6.3")
653 (source
654 (origin
655 (method git-fetch)
656 (uri (git-reference
657 (url "https://github.com/Anaconda-Platform/anaconda-client")
658 (commit version)))
659 (file-name (git-file-name name version))
660 (sha256
661 (base32
662 "0w1bfxnydjl9qp53r2gcvr6vlpdqqilcrzqxrll9sgg6vwdyiyyp"))))
663 (build-system python-build-system)
664 (propagated-inputs
665 `(("python-pyyaml" ,python-pyyaml)
666 ("python-requests" ,python-requests)
667 ("python-clyent" ,python-clyent)))
668 (native-inputs
669 `(("python-pytz" ,python-pytz)
670 ("python-dateutil" ,python-dateutil)
671 ("python-mock" ,python-mock)
672 ("python-coverage" ,python-coverage)
673 ("python-pillow" ,python-pillow)))
674 (arguments
675 `(#:phases
676 (modify-phases %standard-phases
677 ;; This is needed for some tests.
678 (add-before 'check 'set-up-home
679 (lambda* _ (setenv "HOME" "/tmp") #t))
680 (add-before 'check 'remove-network-tests
681 (lambda* _
682 ;; Remove tests requiring a network connection
683 (let ((network-tests '("tests/test_upload.py"
684 "tests/test_authorizations.py"
685 "tests/test_login.py"
686 "tests/test_whoami.py"
687 "utils/notebook/tests/test_data_uri.py"
688 "utils/notebook/tests/test_base.py"
689 "utils/notebook/tests/test_downloader.py"
690 "inspect_package/tests/test_conda.py")))
691 (with-directory-excursion "binstar_client"
692 (for-each delete-file network-tests)))
693 #t)))))
694 (home-page "https://github.com/Anaconda-Platform/anaconda-client")
695 (synopsis "Anaconda Cloud command line client library")
696 (description
697 "Anaconda Cloud command line client library provides an interface to
698 Anaconda Cloud. Anaconda Cloud is useful for sharing packages, notebooks and
699 environments.")
700 (license license:bsd-3)))
701
702 (define-public python2-anaconda-client
703 (package-with-python2 python-anaconda-client))
704
705 (define-public python-conda
706 (package
707 (name "python-conda")
708 (version "4.3.16")
709 (source
710 (origin
711 (method git-fetch)
712 (uri (git-reference
713 (url "https://github.com/conda/conda")
714 (commit version)))
715 (file-name (git-file-name name version))
716 (sha256
717 (base32
718 "1qwy0awx4qf2pbk8z2b7q6wdcq7mvwpxxjhg27mbirdvs5hw7hb2"))))
719 (build-system python-build-system)
720 (arguments
721 `(#:phases
722 (modify-phases %standard-phases
723 (add-before 'build 'create-version-file
724 (lambda _
725 (with-output-to-file "conda/.version"
726 (lambda () (display ,version)))
727 #t))
728 (add-before 'check 'remove-failing-tests
729 (lambda _
730 ;; These tests require internet/network access
731 (let ((network-tests '("test_cli.py"
732 "test_create.py"
733 "test_export.py"
734 "test_fetch.py"
735 "test_history.py"
736 "test_info.py"
737 "test_install.py"
738 "test_priority.py"
739 "conda_env/test_cli.py"
740 "conda_env/test_create.py"
741 "conda_env/specs/test_notebook.py"
742 "conda_env/utils/test_notebooks.py"
743 "core/test_index.py"
744 "core/test_repodata.py")))
745 (with-directory-excursion "tests"
746 (for-each delete-file network-tests)
747
748 ;; FIXME: This test creates a file, then deletes it and tests
749 ;; that the file was deleted. For some reason it fails when
750 ;; building with guix, but does not when you run it in the
751 ;; directory left when you build with the --keep-failed
752 ;; option
753 (delete-file "gateways/disk/test_delete.py")
754 ;; This file is no longer writable after downloading with 'git-fetch'
755 (make-file-writable "conda_env/support/saved-env/environment.yml")
756 #t))))
757 (replace 'check
758 (lambda _
759 (setenv "HOME" "/tmp")
760 (invoke "py.test"))))))
761 (native-inputs
762 `(("python-cytoolz" ,python-cytoolz)
763 ("python-ruamel.yaml" ,python-ruamel.yaml)
764 ("python-requests" ,python-requests)
765 ("python-pycosat" ,python-pycosat)
766 ("python-pytest" ,python-pytest)
767 ("python-responses" ,python-responses)
768 ("python-pyyaml" ,python-pyyaml)
769 ("python-anaconda-client" ,python-anaconda-client)))
770 (home-page "https://github.com/conda/conda")
771 (synopsis "Cross-platform, OS-agnostic, system-level binary package manager")
772 (description
773 "Conda is a cross-platform, Python-agnostic binary package manager. It
774 is the package manager used by Anaconda installations, but it may be used for
775 other systems as well. Conda makes environments first-class citizens, making
776 it easy to create independent environments even for C libraries. Conda is
777 written entirely in Python.
778
779 This package provides Conda as a library.")
780 (license license:bsd-3)))
781
782 (define-public python2-conda
783 (let ((base (package-with-python2
784 (strip-python2-variant python-conda))))
785 (package (inherit base)
786 (native-inputs
787 `(("python2-enum34" ,python2-enum34)
788 ,@(package-native-inputs base))))))
789
790 (define-public conda
791 (package (inherit python-conda)
792 (name "conda")
793 (arguments
794 (substitute-keyword-arguments (package-arguments python-conda)
795 ((#:phases phases)
796 `(modify-phases ,phases
797 (replace 'build
798 (lambda* (#:key outputs #:allow-other-keys)
799 ;; This test fails when run before installation.
800 (delete-file "tests/test_activate.py")
801
802 ;; Fix broken defaults
803 (substitute* "conda/base/context.py"
804 (("return sys.prefix")
805 (string-append "return \"" (assoc-ref outputs "out") "\""))
806 (("return (prefix_is_writable\\(self.root_prefix\\))" _ match)
807 (string-append "return False if self.root_prefix == self.conda_prefix else "
808 match)))
809
810 ;; The util/setup-testing.py is used to build conda in
811 ;; application form, rather than the default, library form.
812 ;; With this, we are able to run commands like `conda --help`
813 ;; directly on the command line
814 (invoke "python" "utils/setup-testing.py" "build_py")))
815 (replace 'install
816 (lambda* (#:key inputs outputs #:allow-other-keys)
817 (let* ((out (assoc-ref outputs "out"))
818 (target (string-append out "/lib/python"
819 (python-version
820 (assoc-ref inputs "python"))
821 "/site-packages/")))
822 ;; The installer aborts if the target directory is not on
823 ;; PYTHONPATH.
824 (setenv "PYTHONPATH"
825 (string-append target ":" (getenv "PYTHONPATH")))
826
827 ;; And it aborts if the directory doesn't exist.
828 (mkdir-p target)
829 (invoke "python" "utils/setup-testing.py" "install"
830 (string-append "--prefix=" out)))))
831 ;; The "activate" and "deactivate" scripts don't need wrapping.
832 ;; They also break when they are renamed.
833 (add-after 'wrap 'undo-wrap
834 (lambda* (#:key outputs #:allow-other-keys)
835 (with-directory-excursion (string-append (assoc-ref outputs "out") "/bin/")
836 (delete-file "deactivate")
837 (rename-file ".deactivate-real" "deactivate")
838 (delete-file "activate")
839 (rename-file ".activate-real" "activate")
840 #t)))))))
841 (description
842 "Conda is a cross-platform, Python-agnostic binary package manager. It
843 is the package manager used by Anaconda installations, but it may be used for
844 other systems as well. Conda makes environments first-class citizens, making
845 it easy to create independent environments even for C libraries. Conda is
846 written entirely in Python.")))
847
848 (define-public gwl
849 (package
850 (name "gwl")
851 (version "0.2.1")
852 (source (origin
853 (method url-fetch)
854 (uri (string-append "mirror://gnu/gwl/gwl-" version ".tar.gz"))
855 (sha256
856 (base32
857 "1ji5jvzni8aml9fmimlr11g3k8isrnlvnbzhmwgdjh72hils0alc"))))
858 (build-system gnu-build-system)
859 (arguments
860 `(#:phases
861 (modify-phases %standard-phases
862 (add-before 'build 'fix-tests
863 (lambda _
864 ;; Avoid cross-device link.
865 (substitute* "tests/cache.scm"
866 (("/tmp/gwl-test-input-XXXXXX")
867 (string-append (getcwd) "/gwl-test-input-XXXXXX")))
868 #t)))))
869 (native-inputs
870 `(("autoconf" ,autoconf)
871 ("automake" ,automake)
872 ("pkg-config" ,pkg-config)
873 ("texinfo" ,texinfo)
874 ("graphviz" ,graphviz)))
875 (inputs
876 `(("guile" ,guile-3.0)))
877 (propagated-inputs
878 `(("guix" ,guix)
879 ("guile-commonmark" ,guile-commonmark)
880 ("guile-gcrypt" ,guile-gcrypt)
881 ("guile-pfds" ,guile-pfds)
882 ("guile-syntax-highlight" ,guile-syntax-highlight)
883 ("guile-wisp" ,guile-wisp)))
884 (home-page "https://workflows.guix.info")
885 (synopsis "Workflow management extension for GNU Guix")
886 (description "The @dfn{Guix Workflow Language} (GWL) provides an
887 extension to GNU Guix's declarative language for package management to
888 automate the execution of programs in scientific workflows. The GWL
889 can use process engines to integrate with various computing
890 environments.")
891 ;; The Scheme modules in guix/ and gnu/ are licensed GPL3+,
892 ;; the web interface modules in gwl/ are licensed AGPL3+,
893 ;; and the fonts included in this package are licensed OFL1.1.
894 (license (list license:gpl3+ license:agpl3+ license:silofl1.1))))
895
896 (define-public guix-jupyter
897 (package
898 (name "guix-jupyter")
899 (version "0.1.0")
900 (home-page "https://gitlab.inria.fr/guix-hpc/guix-kernel")
901 (source (origin
902 (method git-fetch)
903 (uri (git-reference (url home-page)
904 (commit (string-append "v" version))))
905 (sha256
906 (base32
907 "01z7jjkc7r7lj6637rcgpz40v8xqqyfp6871h94yvcnwm7zy9h1n"))
908 (modules '((guix build utils)))
909 (snippet
910 '(begin
911 ;; Allow builds with Guile 3.0.
912 (substitute* "configure.ac"
913 (("^GUILE_PKG.*")
914 "GUILE_PKG([3.0 2.2])\n"))
915 #t))
916 (file-name (string-append "guix-jupyter-" version "-checkout"))))
917 (build-system gnu-build-system)
918 (arguments
919 `(#:modules ((srfi srfi-26)
920 (ice-9 match)
921 (ice-9 popen)
922 (ice-9 rdelim)
923 (guix build utils)
924 (guix build gnu-build-system))
925 #:phases
926 (modify-phases %standard-phases
927 (add-after 'install 'sed-kernel-json
928 (lambda* (#:key inputs outputs #:allow-other-keys)
929 (let* ((out (assoc-ref outputs "out"))
930 (guix (assoc-ref inputs "guix"))
931 (guile (assoc-ref inputs "guile"))
932 (json (assoc-ref inputs "guile-json"))
933 (git (assoc-ref inputs "guile-git"))
934 (bs (assoc-ref inputs "guile-bytestructures"))
935 (s-zmq (assoc-ref inputs "guile-simple-zmq"))
936 (gcrypt (assoc-ref inputs "guile-gcrypt"))
937 (deps (list out s-zmq guix json git bs gcrypt))
938 (effective
939 (read-line
940 (open-pipe* OPEN_READ
941 (string-append guile "/bin/guile")
942 "-c" "(display (effective-version))")))
943 (path (map (cut string-append "-L\", \"" <>
944 "/share/guile/site/"
945 effective)
946 deps))
947 (gopath (map (cut string-append "-C\", \"" <>
948 "/lib/guile/" effective
949 "/site-ccache")
950 deps))
951 (kernel-dir (string-append out "/share/jupyter/kernels/guix/")))
952 (substitute* (string-append kernel-dir "kernel.json")
953 (("-s")
954 (string-join
955 (list (string-join path "\",\n\t\t\"")
956 (string-join gopath "\",\n\t\t\"")
957 "-s")
958 "\",\n\t\t\""))
959 (("guix-jupyter-kernel.scm")
960 (string-append out "/share/guile/site/2.2/"
961 "guix-jupyter-kernel.scm")))
962 #t))))))
963 (native-inputs
964 `(("autoconf" ,autoconf)
965 ("automake" ,automake)
966 ("pkg-config" ,pkg-config)
967
968 ;; For testing.
969 ("jupyter" ,jupyter)
970 ("python-ipython" ,python-ipython)
971 ("python-ipykernel" ,python-ipykernel)))
972 (inputs
973 `(("guix" ,guix)
974 ("guile" ,guile-3.0)))
975 (propagated-inputs
976 `(("guile-json" ,guile-json-3)
977 ("guile-simple-zmq" ,guile-simple-zmq)
978 ("guile-gcrypt" ,guile-gcrypt)))
979 (synopsis "Guix kernel for Jupyter")
980 (description
981 "Guix-Jupyter is a Jupyter kernel. It allows you to annotate notebooks
982 with information about their software dependencies, such that code is executed
983 in the right software environment. Guix-Jupyter spawns the actual kernels
984 such as @code{python-ipykernel} on behalf of the notebook user and runs them
985 in an isolated environment, in separate namespaces.")
986 (license license:gpl3+)))
987
988 (define-public gcab
989 (package
990 (name "gcab")
991 (version "1.2")
992 (source (origin
993 (method url-fetch)
994 (uri (string-append "mirror://gnome/sources/gcab/"
995 version "/gcab-" version ".tar.xz"))
996 (sha256
997 (base32
998 "038h5kk41si2hc9d9169rrlvp8xgsxq27kri7hv2vr39gvz9cbas"))))
999 (build-system meson-build-system)
1000 (native-inputs
1001 `(("glib:bin" ,glib "bin") ; for glib-mkenums
1002 ("intltool" ,intltool)
1003 ("pkg-config" ,pkg-config)
1004 ("vala" ,vala)))
1005 (inputs
1006 `(("glib" ,glib)
1007 ("zlib" ,zlib)))
1008 (arguments
1009 `(#:configure-flags
1010 ;; XXX This ‘documentation’ is for developers, and fails informatively:
1011 ;; Error in gtkdoc helper script: 'gtkdoc-mkhtml' failed with status 5
1012 (list "-Ddocs=false"
1013 "-Dintrospection=false")))
1014 (home-page "https://wiki.gnome.org/msitools") ; no dedicated home page
1015 (synopsis "Microsoft Cabinet file manipulation library")
1016 (description
1017 "The libgcab library provides GObject functions to read, write, and modify
1018 Microsoft cabinet (.@dfn{CAB}) files.")
1019 (license (list license:gpl2+ ; tests/testsuite.at
1020 license:lgpl2.1+)))) ; the rest
1021
1022 (define-public msitools
1023 (package
1024 (name "msitools")
1025 (version "0.100")
1026 (source (origin
1027 (method url-fetch)
1028 (uri (string-append "mirror://gnome/sources/msitools/"
1029 version "/msitools-" version ".tar.xz"))
1030 (sha256
1031 (base32
1032 "1skq17qr2ic4qr3779j49byfm8rncwbsq9rj1a33ncn2m7isdwdv"))))
1033 (build-system gnu-build-system)
1034 (native-inputs
1035 `(("bison" ,bison)
1036 ("pkg-config" ,pkg-config)))
1037 (inputs
1038 `(("gcab" ,gcab)
1039 ("glib" ,glib)
1040 ("libgsf" ,libgsf)
1041 ("libxml2" ,libxml2)
1042 ("uuid" ,util-linux "lib")))
1043 (home-page "https://wiki.gnome.org/msitools")
1044 (synopsis "Windows Installer file manipulation tool")
1045 (description
1046 "msitools is a collection of command-line tools to inspect, extract, build,
1047 and sign Windows@tie{}Installer (.@dfn{MSI}) files. It aims to be a solution
1048 for packaging and deployment of cross-compiled Windows applications.")
1049 (license license:lgpl2.1+)))
1050
1051 (define-public libostree
1052 (package
1053 (name "libostree")
1054 (version "2020.3")
1055 (source (origin
1056 (method url-fetch)
1057 (uri (string-append
1058 "https://github.com/ostreedev/ostree/releases/download/v"
1059 (version-major+minor version) "/libostree-" version ".tar.xz"))
1060 (sha256
1061 (base32
1062 "01cch4as23xspq6pck59al7x5jj60wl21g8p3iqbdxcjl1p3jxsq"))))
1063 (build-system gnu-build-system)
1064 (arguments
1065 '(#:phases
1066 (modify-phases %standard-phases
1067 (add-before 'check 'pre-check
1068 (lambda _
1069 ;; Don't try to use the non-existing '/var/tmp' as test
1070 ;; directory.
1071 (setenv "TEST_TMPDIR" (getenv "TMPDIR"))
1072 #t)))
1073 ;; XXX: fails with:
1074 ;; tap-driver.sh: missing test plan
1075 ;; tap-driver.sh: internal error getting exit status
1076 ;; tap-driver.sh: fatal: I/O or internal error
1077 #:tests? #f))
1078 (native-inputs
1079 `(("attr" ,attr) ; for tests
1080 ("bison" ,bison)
1081 ("glib:bin" ,glib "bin") ; for 'glib-mkenums'
1082 ("gobject-introspection" ,gobject-introspection)
1083 ("pkg-config" ,pkg-config)
1084 ("xsltproc" ,libxslt)))
1085 (inputs
1086 `(("avahi" ,avahi)
1087 ("docbook-xml" ,docbook-xml-4.2)
1088 ("docbook-xsl" ,docbook-xsl)
1089 ("e2fsprogs" ,e2fsprogs)
1090 ("fuse" ,fuse)
1091 ("glib" ,glib)
1092 ("gpgme" ,gpgme)
1093 ("libarchive" ,libarchive)
1094 ("libsoup" ,libsoup)
1095 ("util-linux" ,util-linux)))
1096 (home-page "https://ostree.readthedocs.io/en/latest/")
1097 (synopsis "Operating system and container binary deployment and upgrades")
1098 (description
1099 "@code{libostree} is both a shared library and suite of command line
1100 tools that combines a \"git-like\" model for committing and downloading
1101 bootable file system trees, along with a layer for deploying them and managing
1102 the boot loader configuration.")
1103 (license license:lgpl2.0+)))
1104
1105 (define-public flatpak
1106 (package
1107 (name "flatpak")
1108 (version "1.4.3")
1109 (source
1110 (origin
1111 (method url-fetch)
1112 (uri (string-append "https://github.com/flatpak/flatpak/releases/download/"
1113 version "/flatpak-" version ".tar.xz"))
1114 (sha256
1115 (base32
1116 "11bfxmv8pxlb5x0lb2rsl45615fzfvq5r6wldf0l6ab2ngryd7i7"))))
1117
1118 ;; Wrap 'flatpak' so that GIO_EXTRA_MODULES is set, thereby allowing GIO to
1119 ;; find the TLS backend in glib-networking.
1120 (build-system glib-or-gtk-build-system)
1121
1122 (arguments
1123 '(#:tests? #f ;; Tests fail due to trying to create files where it can't.
1124 #:configure-flags (list
1125 "--enable-documentation=no" ;; FIXME
1126 "--enable-system-helper=no"
1127 "--localstatedir=/var"
1128 (string-append "--with-system-bubblewrap="
1129 (assoc-ref %build-inputs "bubblewrap")
1130 "/bin/bwrap"))))
1131 (native-inputs `(("bison" ,bison)
1132 ("gettext" ,gettext-minimal)
1133 ("glib:bin" ,glib "bin") ; for glib-mkenums + gdbus-codegen
1134 ("gobject-introspection" ,gobject-introspection)
1135 ("libcap" ,libcap)
1136 ("pkg-config" ,pkg-config)))
1137 (propagated-inputs `(("glib-networking" ,glib-networking)
1138 ("gnupg" ,gnupg)
1139 ("gsettings-desktop-schemas"
1140 ,gsettings-desktop-schemas)))
1141 (inputs `(("appstream-glib" ,appstream-glib)
1142 ("bubblewrap" ,bubblewrap)
1143 ("dconf" ,dconf)
1144 ("fuse" ,fuse)
1145 ("gdk-pixbuf" ,gdk-pixbuf)
1146 ("gpgme" ,gpgme)
1147 ("json-glib" ,json-glib)
1148 ("libarchive" ,libarchive)
1149 ("libostree" ,libostree)
1150 ("libseccomp" ,libseccomp)
1151 ("libsoup" ,libsoup)
1152 ("libxau" ,libxau)
1153 ("libxml2" ,libxml2)
1154 ("util-linux" ,util-linux)))
1155 (home-page "https://flatpak.org")
1156 (synopsis "System for building, distributing, and running sandboxed desktop
1157 applications")
1158 (description "Flatpak is a system for building, distributing, and running
1159 sandboxed desktop applications on GNU/Linux.")
1160 (license license:lgpl2.1+)))