1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2017 Muriithi Frederick Muriuki <fredmanglis@gmail.com>
5 ;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
6 ;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages package-management)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (guix gexp)
28 #:use-module (guix utils)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system python)
31 #:use-module (guix build-system emacs)
32 #:use-module ((guix licenses) #:select (gpl2+ gpl3+ agpl3+ lgpl2.1+ asl2.0
34 #:use-module (gnu packages)
35 #:use-module (gnu packages guile)
36 #:use-module (gnu packages file)
37 #:use-module (gnu packages backup)
38 #:use-module (gnu packages bootstrap) ;for 'bootstrap-guile-origin'
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages gnupg)
41 #:use-module (gnu packages databases)
42 #:use-module (gnu packages graphviz)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages autotools)
45 #:use-module (gnu packages gettext)
46 #:use-module (gnu packages lisp)
47 #:use-module (gnu packages texinfo)
48 #:use-module (gnu packages nettle)
49 #:use-module (gnu packages perl)
50 #:use-module (gnu packages curl)
51 #:use-module (gnu packages web)
52 #:use-module (gnu packages man)
53 #:use-module (gnu packages bdw-gc)
54 #:use-module (gnu packages patchutils)
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages popt)
57 #:use-module (gnu packages gnuzilla)
58 #:use-module (gnu packages cpio)
59 #:use-module (gnu packages tls)
60 #:use-module (gnu packages ssh)
61 #:use-module (gnu packages vim)
62 #:use-module (gnu packages serialization)
63 #:use-module (srfi srfi-1)
64 #:use-module (ice-9 match))
66 (define (boot-guile-uri arch)
67 "Return the URI for the bootstrap Guile tarball for ARCH."
68 (cond ((string=? "armhf" arch)
69 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
71 "/20150101/guile-2.0.11.tar.xz"))
72 ((string=? "aarch64" arch)
73 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
74 arch "-linux/20170217/guile-2.0.14.tar.xz"))
76 (string-append "http://alpha.gnu.org/gnu/guix/bootstrap/"
78 "/20131110/guile-2.0.9.tar.xz"))))
81 ;; Latest version of Guix, which may or may not correspond to a release.
82 ;; Note: the 'update-guix-package.scm' script expects this definition to
83 ;; start precisely like this.
84 (let ((version "0.13.0")
85 (commit "357ab93aacbd882a48cd7961ab301afa78c941d0")
90 (version (if (zero? revision)
92 (string-append version "-"
93 (number->string revision)
94 "." (string-take commit 7))))
98 (url "https://git.savannah.gnu.org/r/guix.git")
102 "19cf4gpdkqv8lxpqg4ibmxhmnsm2ggi3wrhaslfmypa2a5b5jls1"))
103 (file-name (string-append "guix-" version "-checkout"))))
104 (build-system gnu-build-system)
106 `(#:configure-flags (list
107 "--localstatedir=/var"
109 (string-append "--with-bash-completion-dir="
110 (assoc-ref %outputs "out")
111 "/etc/bash_completion.d")
112 (string-append "--with-libgcrypt-prefix="
113 (assoc-ref %build-inputs
116 ;; Set 'DOT_USER_PROGRAM' to the empty string so
117 ;; we don't keep a reference to Graphviz, whose
118 ;; closure is pretty big (too big for the GuixSD
119 ;; installation image.)
120 "ac_cv_path_DOT_USER_PROGRAM=dot"
122 ;; To avoid problems with the length of shebangs,
123 ;; choose a fixed-width and short directory name
125 "ac_cv_guix_test_root=/tmp/guix-tests")
126 #:parallel-tests? #f ;work around <http://bugs.gnu.org/21097>
128 #:modules ((guix build gnu-build-system)
134 #:phases (modify-phases %standard-phases
135 (add-after 'unpack 'bootstrap
137 ;; Make sure 'msgmerge' can modify the PO files.
138 (for-each (lambda (po)
140 (find-files "." "\\.po$"))
142 (zero? (system* "sh" "bootstrap"))))
144 'configure 'copy-bootstrap-guile
145 (lambda* (#:key system inputs #:allow-other-keys)
146 (define (boot-guile-version arch)
147 (cond ((string=? "armhf" arch) "2.0.11")
148 ((string=? "aarch64" arch) "2.0.14")
152 (let ((guile (assoc-ref inputs
153 (string-append "boot-guile/"
155 (target (string-append "gnu/packages/bootstrap/"
158 (boot-guile-version arch)
160 (mkdir-p (dirname target)) ;XXX: eventually unneeded
161 (copy-file guile target)))
170 'unpack 'disable-container-tests
171 ;; XXX FIXME: These tests fail within the build container.
173 (substitute* "tests/syscalls.scm"
174 (("^\\(test-(assert|equal) \"(clone|setns|pivot-root)\"" all)
175 (string-append "(test-skip 1)\n" all)))
176 (substitute* "tests/containers.scm"
177 (("^\\(test-(assert|equal)" all)
178 (string-append "(test-skip 1)\n" all)))
179 (when (file-exists? "tests/guix-environment-container.sh")
180 (substitute* "tests/guix-environment-container.sh"
181 (("guix environment --version")
184 (add-before 'check 'set-SHELL
186 ;; 'guix environment' tests rely on 'SHELL' having a
187 ;; correct value, so set it.
188 (setenv "SHELL" (which "sh"))
190 (add-after 'install 'wrap-program
191 (lambda* (#:key inputs outputs #:allow-other-keys)
192 ;; Make sure the 'guix' command finds GnuTLS and
193 ;; Guile-JSON automatically.
194 (let* ((out (assoc-ref outputs "out"))
195 (guile (assoc-ref inputs "guile"))
196 (json (assoc-ref inputs "guile-json"))
197 (git (assoc-ref inputs "guile-git"))
198 (ssh (assoc-ref inputs "guile-ssh"))
199 (gnutls (assoc-ref inputs "gnutls"))
200 (deps (list json gnutls git ssh))
203 (open-pipe* OPEN_READ
204 (string-append guile "/bin/guile")
205 "-c" "(display (effective-version))")))
207 (map (cut string-append <>
213 (map (cut string-append <>
214 "/lib/guile/" effective
219 (wrap-program (string-append out "/bin/guix")
220 `("GUILE_LOAD_PATH" ":" prefix (,path))
221 `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,gopath)))
224 (native-inputs `(("pkg-config" ,pkg-config)
226 ;; XXX: Keep the development inputs here even though
227 ;; they're unnecessary, just so that 'guix environment
228 ;; guix' always contains them.
229 ("autoconf" ,(autoconf-wrapper))
230 ("automake" ,automake)
231 ("gettext" ,gettext-minimal)
233 ("graphviz" ,graphviz)
234 ("help2man" ,help2man)))
238 ("zlib" ,zlib) ;for 'guix publish'
241 ("libgcrypt" ,libgcrypt)
244 ("boot-guile/i686" ,(bootstrap-guile-origin "i686-linux"))
245 ("boot-guile/x86_64" ,(bootstrap-guile-origin "x86_64-linux"))
246 ("boot-guile/mips64el" ,(bootstrap-guile-origin "mips64el-linux"))
247 ("boot-guile/armhf" ,(bootstrap-guile-origin "armhf-linux"))
248 ("boot-guile/aarch64" ,(bootstrap-guile-origin "aarch64-linux"))))
251 ("guile-json" ,guile-json)
252 ("guile-ssh" ,guile-ssh)
253 ("guile-git" ,guile-git)))
255 (home-page "https://www.gnu.org/software/guix/")
256 (synopsis "Functional package manager for installed software packages and versions")
258 "GNU Guix is a functional package manager for the GNU system, and is
259 also a distribution thereof. It includes a virtual machine image. Besides
260 the usual package management features, it also supports transactional
261 upgrades and roll-backs, per-user profiles, and much more. It is based on
262 the Nix package manager.")
264 (properties '((ftp-server . "alpha.gnu.org"))))))
266 ;; Alias for backward compatibility.
267 (define-public guix-devel guix)
269 (define-public guile2.0-guix
272 (name "guile2.0-guix")
274 `(("guile" ,guile-2.0)
275 ,@(alist-delete "guile" (package-inputs guix))))
277 `(("gnutls" ,gnutls/guile-2.0)
278 ("guile-json" ,guile2.0-json)
279 ("guile-ssh" ,guile2.0-ssh)
280 ("guile-git" ,guile2.0-git)))))
282 (define (source-file? file stat)
283 "Return true if FILE is likely a source file, false if it is a typical
285 (define (wrong-extension? file)
286 (or (string-suffix? "~" file)
287 (member (file-extension file)
288 '("o" "a" "lo" "so" "go"))))
290 (match (basename file)
291 ((or ".git" "autom4te.cache" "configure" "Makefile" "Makefile.in" ".libs")
293 ((? wrong-extension?)
298 (define-public current-guix
299 (let* ((repository-root (canonicalize-path
300 (string-append (current-source-directory)
302 (select? (delay (or (git-predicate repository-root)
305 "Return a package representing Guix built from the current source tree.
306 This works by adding the current source tree to the store (after filtering it
307 out) and returning a package that uses that as its 'source'."
310 (version (string-append (package-version guix) "+"))
311 (source (local-file repository-root "guix-current"
313 #:select? (force select?)))))))
326 (uri (string-append "http://nixos.org/releases/nix/nix-"
327 version "/nix-" version ".tar.xz"))
330 "1qg7qrfr60dysmyfg3ijgani71l23p1kqadhjs8kz11pgwkkx50f"))))
331 (build-system gnu-build-system)
332 ;; XXX: Should we pass '--with-store-dir=/gnu/store'? But then we'd also
333 ;; need '--localstatedir=/var'. But then! The thing would use /var/nix
334 ;; instead of /var/guix. So in the end, we do nothing special.
337 ;; Set the prefixes of Perl libraries to avoid propagation.
338 (let ((perl-libdir (lambda (p)
340 (assoc-ref %build-inputs p)
341 "/lib/perl5/site_perl"))))
342 (list (string-append "--with-dbi="
343 (perl-libdir "perl-dbi"))
344 (string-append "--with-dbd-sqlite="
345 (perl-libdir "perl-dbd-sqlite"))
346 (string-append "--with-www-curl="
347 (perl-libdir "perl-www-curl"))))))
348 (native-inputs `(("perl" ,perl)
349 ("pkg-config" ,pkg-config)))
350 (inputs `(("curl" ,curl)
355 ("perl-www-curl" ,perl-www-curl)
356 ("perl-dbi" ,perl-dbi)
357 ("perl-dbd-sqlite" ,perl-dbd-sqlite)))
358 (home-page "http://nixos.org/nix/")
359 (synopsis "The Nix package manager")
361 "Nix is a purely functional package manager. This means that it treats
362 packages like values in purely functional programming languages such as
363 Haskell—they are built by functions that don't have side-effects, and they
364 never change after they have been built. Nix stores packages in the Nix
365 store, usually the directory /nix/store, where each package has its own unique
369 (define-public emacs-nix-mode
372 (name "emacs-nix-mode")
373 (build-system emacs-build-system)
376 (modify-phases %standard-phases
377 (add-after 'unpack 'chdir-elisp
378 ;; Elisp directory is not in root of the source.
380 (chdir "misc/emacs"))))))
381 (synopsis "Emacs major mode for editing Nix expressions")
382 (description "@code{nixos-mode} provides an Emacs major mode for editing
383 Nix expressions. It supports syntax highlighting, indenting and refilling of
392 (uri (string-append "mirror://gnu/stow/stow-"
396 "1pvky9fayms4r6fhns8jd0vavszd7d979w62vfd5n88v614pdxz2"))))
397 (build-system gnu-build-system)
401 `(("perl-test-simple" ,perl-test-simple)
402 ("perl-test-output" ,perl-test-output)
403 ("perl-capture-tiny" ,perl-capture-tiny)
404 ("perl-io-stringy" ,perl-io-stringy)))
405 (home-page "https://www.gnu.org/software/stow/")
406 (synopsis "Managing installed software packages")
408 "GNU Stow is a symlink manager. It generates symlinks to directories
409 of data and makes them appear to be merged into the same directory. It is
410 typically used for managing software packages installed from source, by
411 letting you install them apart in distinct directories and then create
412 symlinks to the files in a common directory such as /usr/local.")
421 (uri (string-append "http://ftp.rpm.org/releases/rpm-"
422 (version-major+minor version) ".x/rpm-"
426 "03cvbwbfrhm0fa02j7828k1qp05hf2m0fradwcf2nqhrsjkppz17"))))
427 (build-system gnu-build-system)
429 '(#:configure-flags '("--with-external-db" ;use the system's bdb
432 #:phases (modify-phases %standard-phases
433 (add-before 'configure 'set-nspr-search-path
434 (lambda* (#:key inputs #:allow-other-keys)
435 ;; nspr.pc contains the right -I flag pointing to
436 ;; 'include/nspr', but unfortunately 'configure' doesn't
437 ;; use 'pkg-config'. Thus, augment CPATH.
439 (let ((nspr (assoc-ref inputs "nspr"))
440 (nss (assoc-ref inputs "nss")))
442 (string-append (getenv "C_INCLUDE_PATH") ":"
443 nspr "/include/nspr:"
445 (setenv "LIBRARY_PATH"
446 (string-append (getenv "LIBRARY_PATH") ":"
449 (add-after 'install 'fix-rpm-symlinks
450 (lambda* (#:key outputs #:allow-other-keys)
451 ;; 'make install' gets these symlinks wrong. Fix them.
452 (let* ((out (assoc-ref outputs "out"))
453 (bin (string-append out "/bin")))
454 (with-directory-excursion bin
455 (for-each (lambda (file)
457 (symlink "rpm" file))
458 '("rpmquery" "rpmverify"))
461 `(("pkg-config" ,pkg-config)))
463 `(("python" ,python-2)
469 ("libarchive" ,libarchive)
470 ("nettle" ,nettle) ;XXX: actually a dependency of libarchive
475 (home-page "http://www.rpm.org/")
476 (synopsis "The RPM Package Manager")
478 "The RPM Package Manager (RPM) is a command-line driven package
479 management system capable of installing, uninstalling, verifying, querying,
480 and updating computer software packages. Each software package consists of an
481 archive of files along with information about the package like its version, a
482 description. There is also a library permitting developers to manage such
483 transactions from C or Python.")
485 ;; The whole is GPLv2+; librpm itself is dual-licensed LGPLv2+ | GPLv2+.
488 (define-public diffoscope
494 (uri (pypi-uri name version))
497 "093lxy6zj69i19fxdkj3jnai3b1ajqbksyqcvy8wqj3plaaxjna5"))))
498 (build-system python-build-system)
500 `(#:phases (modify-phases %standard-phases
501 (add-before 'unpack 'n (lambda _ #t))
502 ;; setup.py mistakenly requires python-magic from PyPi, even
503 ;; though the Python bindings of `file` are sufficient.
504 ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815844
505 (add-after 'unpack 'dependency-on-python-magic
507 (substitute* "setup.py"
508 (("'python-magic',") ""))))
509 (add-after 'unpack 'embed-tool-references
510 (lambda* (#:key inputs #:allow-other-keys)
511 (substitute* "diffoscope/comparators/utils/compare.py"
513 (string-append "['" (which "xxd") "',")))
514 (substitute* "diffoscope/comparators/elf.py"
515 (("@tool_required\\('readelf'\\)") "")
517 (string-append "['" (which "readelf") "',")))
519 (inputs `(("rpm" ,rpm) ;for rpm-python
520 ("python-file" ,python-file)
521 ("python-debian" ,python-debian)
522 ("python-libarchive-c" ,python-libarchive-c)
523 ("python-tlsh" ,python-tlsh)
524 ("colordiff" ,colordiff)
527 ;; Below are modules used for tests.
528 ("python-pytest" ,python-pytest)
529 ("python-chardet" ,python-chardet)))
530 (home-page "https://diffoscope.org/")
531 (synopsis "Compare files, archives, and directories in depth")
533 "Diffoscope tries to get to the bottom of what makes files or directories
534 different. It recursively unpacks archives of many kinds and transforms
535 various binary formats into more human readable forms to compare them. It can
536 compare two tarballs, ISO images, or PDFs just as easily.")
539 (define-public python-anaconda-client
541 (name "python-anaconda-client")
546 (uri (string-append "https://github.com/Anaconda-Platform/"
547 "anaconda-client/archive/" version ".tar.gz"))
548 (file-name (string-append name "-" version ".tar.gz"))
551 "1wv4wi6k5jz7rlwfgvgfdizv77x3cr1wa2aj0k1595g7fbhkjhz2"))))
552 (build-system python-build-system)
554 `(("python-pyyaml" ,python-pyyaml)
555 ("python-requests" ,python-requests)
556 ("python-clyent" ,python-clyent)))
558 `(("python-pytz" ,python-pytz)
559 ("python-dateutil" ,python-dateutil)
560 ("python-mock" ,python-mock)
561 ("python-coverage" ,python-coverage)
562 ("python-pillow" ,python-pillow)))
565 (modify-phases %standard-phases
566 ;; This is needed for some tests.
567 (add-before 'check 'set-up-home
568 (lambda* _ (setenv "HOME" "/tmp") #t))
569 (add-before 'check 'remove-network-tests
571 ;; Remove tests requiring a network connection
572 (let ((network-tests '("tests/test_upload.py"
573 "tests/test_authorizations.py"
574 "tests/test_login.py"
575 "tests/test_whoami.py"
576 "utils/notebook/tests/test_data_uri.py"
577 "utils/notebook/tests/test_base.py"
578 "utils/notebook/tests/test_downloader.py"
579 "inspect_package/tests/test_conda.py")))
580 (with-directory-excursion "binstar_client"
581 (for-each delete-file network-tests)))
583 (home-page "https://github.com/Anaconda-Platform/anaconda-client")
584 (synopsis "Anaconda Cloud command line client library")
586 "Anaconda Cloud command line client library provides an interface to
587 Anaconda Cloud. Anaconda Cloud is useful for sharing packages, notebooks and
591 (define-public python2-anaconda-client
592 (package-with-python2 python-anaconda-client))
594 (define-public python-conda
596 (name "python-conda")
601 (uri (string-append "https://github.com/conda/conda/archive/"
603 (file-name (string-append name "-" version ".tar.gz"))
606 "1jq8hyrc5npb5sf4vw6s6by4602yj8f79vzpbwdfgpkn02nfk1dv"))))
607 (build-system python-build-system)
610 (modify-phases %standard-phases
611 (add-before 'build 'create-version-file
613 (with-output-to-file "conda/.version"
614 (lambda () (display ,version)))
616 (add-before 'check 'remove-failing-tests
618 ;; These tests require internet/network access
619 (let ((network-tests '("test_cli.py"
627 "conda_env/test_cli.py"
628 "conda_env/test_create.py"
629 "conda_env/specs/test_notebook.py"
630 "conda_env/utils/test_notebooks.py"
632 "core/test_repodata.py")))
633 (with-directory-excursion "tests"
634 (for-each delete-file network-tests)
636 ;; FIXME: This test creates a file, then deletes it and tests
637 ;; that the file was deleted. For some reason it fails when
638 ;; building with guix, but does not when you run it in the
639 ;; directory left when you build with the --keep-failed
641 (delete-file "gateways/disk/test_delete.py")
645 (setenv "HOME" "/tmp")
646 (zero? (system* "py.test")))))))
648 `(("python-ruamel.yaml" ,python-ruamel.yaml)
649 ("python-requests" ,python-requests)
650 ("python-pycosat" ,python-pycosat)
651 ("python-pytest" ,python-pytest)
652 ("python-responses" ,python-responses)
653 ("python-pyyaml" ,python-pyyaml)
654 ("python-anaconda-client" ,python-anaconda-client)))
655 (home-page "https://github.com/conda/conda")
656 (synopsis "Cross-platform, OS-agnostic, system-level binary package manager")
658 "Conda is a cross-platform, Python-agnostic binary package manager. It
659 is the package manager used by Anaconda installations, but it may be used for
660 other systems as well. Conda makes environments first-class citizens, making
661 it easy to create independent environments even for C libraries. Conda is
662 written entirely in Python.
664 This package provides Conda as a library.")
667 (define-public python2-conda
668 (let ((base (package-with-python2
669 (strip-python2-variant python-conda))))
670 (package (inherit base)
672 `(("python2-enum34" ,python2-enum34)
673 ,@(package-native-inputs base))))))
676 (package (inherit python-conda)
679 (substitute-keyword-arguments (package-arguments python-conda)
681 `(modify-phases ,phases
683 (lambda* (#:key outputs #:allow-other-keys)
684 ;; This test fails when run before installation.
685 (delete-file "tests/test_activate.py")
687 ;; Fix broken defaults
688 (substitute* "conda/base/context.py"
689 (("return sys.prefix")
690 (string-append "return \"" (assoc-ref outputs "out") "\""))
691 (("return (prefix_is_writable\\(self.root_prefix\\))" _ match)
692 (string-append "return False if self.root_prefix == self.conda_prefix else "
695 ;; The util/setup-testing.py is used to build conda in
696 ;; application form, rather than the default, library form.
697 ;; With this, we are able to run commands like `conda --help`
698 ;; directly on the command line
699 (zero? (system* "python" "utils/setup-testing.py" "build_py"))))
701 (lambda* (#:key inputs outputs #:allow-other-keys)
702 (let* ((out (assoc-ref outputs "out"))
703 (target (string-append out "/lib/python"
704 ((@@ (guix build python-build-system)
706 (assoc-ref inputs "python"))
708 ;; The installer aborts if the target directory is not on
711 (string-append target ":" (getenv "PYTHONPATH")))
713 ;; And it aborts if the directory doesn't exist.
715 (zero? (system* "python" "utils/setup-testing.py" "install"
716 (string-append "--prefix=" out))))))))))
718 "Conda is a cross-platform, Python-agnostic binary package manager. It
719 is the package manager used by Anaconda installations, but it may be used for
720 other systems as well. Conda makes environments first-class citizens, making
721 it easy to create independent environments even for C libraries. Conda is
722 written entirely in Python.")))
730 (uri (string-append "https://www.guixwl.org/releases/gwl-"
734 "1x4swwp7kmhd57j3scii5c4h8swkcvab2r6mz7wxwwbx300wcqpy"))))
735 (build-system gnu-build-system)
737 `(("autoconf" ,autoconf)
738 ("automake" ,automake)
739 ("pkg-config" ,pkg-config)))
741 `(("guile" ,guile-2.2)))
744 ("guile-commonmark" ,guile-commonmark)))
745 (home-page "https://www.guixwl.org")
746 (synopsis "Workflow management extension for GNU Guix")
747 (description "This project provides two subcommands to GNU Guix and
748 introduces two record types that provide a workflow management extension built
749 on top of GNU Guix.")
750 ;; The Scheme modules in guix/ and gnu/ are licensed GPL3+,
751 ;; the web interface modules in gwl/ are licensed AGPL3+,
752 ;; and the fonts included in this package are licensed OFL1.1.
753 (license (list gpl3+ agpl3+ silofl1.1))))