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