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