GNU Guix explained

GNU Guix
GNU Guix
Logo Size:200px
Status:-->
Programming Language:Guile Scheme, C++ (Nix core)
License:GPLv3+

GNU Guix ([1]) is a functional cross-platform package manager and a tool to instantiate and manage Unix-like operating systems, based on the Nix package manager. Configuration and package recipes are written in Guile Scheme. GNU Guix is the default package manager of the GNU Guix System distribution.[2]

Differing from traditional package managers, Guix (like Nix) utilizes a purely functional deployment model where software is installed into unique directories generated through cryptographic hashes. All dependencies for each software are included within each hash.[3] [4] This solves the problem of dependency hell,[5] allows multiple versions of the same software to coexist and makes packages portable and reproducible. Performing scientific computations in a Guix setup has been proposed as a promising response to the replication crisis.[6] [7]

The development of GNU Guix is intertwined with the GNU Guix System,[8] an installable operating system distribution using the Linux-libre kernel and GNU Shepherd init system.[9] [10] [11]

General features

Guix packages are defined through functional Guile Scheme APIs specifically designed for package management.Dependencies are tracked directly in this language through special values called "derivations" which are evaluated by the Guix daemon lazily.Guix keeps track of these references automatically so that installed packages can be garbage collected when no other package depends on them - at the cost of greater storage requirements, all upgrades in Guix are guaranteed to be both atomic and can be rolled back.

The roll-back feature of Guix is inherited from the design of Nix and is rarely found in other operating systems, since it requires an unorthodox approach to how the system should function (see MicroOS).The Guix package manager, like Nix, can however be used on many distributions like Debian and Parabola.[12] [13] This also enables multiple users to safely install software on the same system without administrator privileges.

Compared to traditional package managers, Guix package stores can grow considerably bigger and therefore require more bandwidth; although compared to container solutions (like Docker) that are also commonly employed to solve dependency hell, Guix is leaner and conforms to practices like don't repeat yourself and single source of truth. If the user chooses to build everything from source, even larger storage space and bandwidth is required.

The store

Inherited from the design of Nix, most of the content of the package manager is kept in a directory /gnu/store where only the Guix daemon has write-access. This is achieved via specialised bind mounts, where the Store as a file system is mounted read only, prohibiting interference even from the root user, while the Guix daemon remounts the Store as read/writable in its own private namespace. Guix talks with this daemon to build things or fetch substitutes which are all kept in the store. Users are discouraged from ever manually touching the store by re-mounting it as writable since this defeats the whole purpose of the store.

Garbage collection

Guix - like Nix - has built-in garbage collection facilities to help prune dead store items and keep the live ones.[14]

Package definitions

This is an example of a package definition for the hello-package:(define-public hello (package (name "hello") (version "2.10") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/hello/hello-" version ".tar.gz")) (sha256 (base32 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) (build-system gnu-build-system) (synopsis "Hello, GNU world: An example GNU package") (description "GNU Hello prints the message \"Hello, world!\" and then exits. It serves as an example of standard GNU coding practices. As such, it supports command-line arguments, multiple languages, and so on.") (home-page "https://www.gnu.org/software/hello/") (license gpl3+)))It is written using Guile. The package recipes can easily be inspected (running e.g. guix edit hello) and changed in Guix, making the system transparent and very easy to modify.

Transactional upgrades

Inherited from the design of Nix, all manipulation of store items is independent of each other, and the directories of the store begin with a base32-encoded hash of the source code of the derivation along with its inputs.

Profiles

Guix package uses profiles generations, which are a collection of symlinks to specific store items together comprising what the user has installed into the profile. Every time a package is installed or removed, a new generation will be built.

E.g. the profile of a user who only installed GNU Hello contains links to the store item which holds the version of hello installed with the currently used guix.

E.g. on version c087a90e06d7b9451f802323e24deb1862a21e0f of guix, this corresponds to the following item: /gnu/store/md2plii4g5sk66wg9cgwc964l3xwhrm9-hello-2.10 (built from the recipe above).

In addition to symlinks, each profile guix builds also contains a union of all the info-manuals, man-pages, icons, fonts, etc. so that the user can browse documentation and have access to all the icons and fonts installed.

The default symlinks to profile generations are stored under /var/guix in the filesystem.

Multiple user profiles

The user can create any number of profiles by invoking . A new directory with the profile-name as well as profile-generation-symlinks will then be created in the current directory.

Roll-back

Guix package enables instantaneous roll-back to a previous profile generation via changing the symlink to an earlier profile generation.[15] Profiles are also stored in the store e.g. this item is a profile containing hello above: /gnu/store/b4wipjlsapvnijmbawl7sh76087vpl4n-profile (built and activated when running guix install hello).

Shell environment

Guix shell enables the user to easily enter an environment where all the necessary packages for development of software are present without clogging up the users default profile with dependencies for multiple projects.[16]

E.g. running enters a throw-away environment where everything needed to compile hello on guix is present (gcc, guile, etc.).

Without the flag, only the package hello would be installed and not its build-dependencies. This supplants the command, which installs the dependencies of a package by default, as it was considered more intuitive for the command to install the specified packages by default and only install development dependencies with a flag.[17]

Persistent development environment

If you want a persistent gc-rooted environment that is not garbage collected on the next run of guix gc you can create a root:

E.g. running enters an environment where everything needed to compile guix is present (gcc, guile, etc.) and registered as a root in the current directory (by symlinking to the items in the store).

Pack

Guix pack enables the user to bundle together store items and output them as either a docker binary image, a relocatable tarball or a squashfs binary.[18]

Graph

Guix graph enables the user to view different graphs of the packages and their dependencies.[19]

Guix System (operating system)

See main article: article and GNU Guix System. GNU Guix System uses Guix as its package manager and configuration system, similar to how NixOS uses Nix.

History

The project was started in June 2012 by Ludovic Courtès, one of the GNU Guile hackers.[20]

The GNU Project announced in November 2012 the first release of GNU Guix, a functional package manager based on Nix that provides, among other things, Guile Scheme APIs.[21]

On August 20, 2015, it was announced that Guix had been ported to GNU Hurd.[22]

Releases

The project has no fixed release schedule and has until now released approximately every 6 months.

VersionAnnouncementSupported architecturesPackages
0.1 (alpha)Web site: GNU Guix 0.1 released (alpha) . Courtès . 18 January 2013 . Ludovic . i686, x86_64~150
0.2 (alpha)Web site: GNU Guix 0.2 released (alpha) . Courtès . 12 May 2013 . Ludovic . ~400
0.3Web site: GNU Guix 0.3 released . Courtès . 17 Jul 2013 . Ludovic . ~430
0.4Web site: GNU Guix 0.4 released . Courtès . 27 Sep 2013 . Ludovic . ~490
0.5Web site: GNU Guix 0.5 released . Courtès . 11 Dec 2013 . Ludovic . ~600
0.6Web site: GNU Guix 0.6 released . Courtès . 9 Apr 2014 . Ludovic . ~691
0.7Web site: GNU Guix 0.7 released . Courtès . 25 Jul 2014 . Ludovic . ~825
0.8Web site: GNU Guix 0.8 released . Courtès . 18 Nov 2014 . Ludovic . i686, x86_64, mips64el~987
0.8.1Web site: GNU Guix 0.8.1 released . Courtès . 29 Jan 2015 . Ludovic . i686, x86_64, mips64el, armv7~1151
0.8.2Web site: GNU Guix 0.8.2 released . Courtès . 14 May 2015 . Ludovic . ~1869
0.8.3Web site: GNU Guix 0.8.3 released . Courtès . 22 Jul 2015 . Ludovic . ~2048
0.9.0Web site: GNU Guix 0.9.0 released . Courtès . 5 Nov 2015 . Ludovic . ~2591
0.10.0Web site: GNU Guix & GuixSD 0.10.0 released . Courtès . 29 Mar 2016 . Ludovic . ~3230
0.11.0Web site: GNU Guix & GuixSD 0.11.0 released . Courtès . 3 Aug 2016 . Ludovic . ~3714
0.12.0Web site: GNU Guix & GuixSD 0.12.0 released . Wurmus . 21 Dec 2016 . Ricardo . ~4567
0.13.0Web site: GNU Guix & GuixSD 0.13.0 released . Courtès . 22 May 2017 . Ludovic . i686, x86_64, mips64el, armv7, aarch64~5407
0.14.0Web site: GNU Guix & GuixSD 0.14.0 released . Courtès . 7 Dec 2017 . Ludovic . ~6618
0.15.0Web site: GNU Guix & GuixSD 0.15.0 released . Courtès . 6 Jul 2018 . Ludovic . ~7857
0.16.0Web site: GNU Guix & GuixSD 0.16.0 released . Courtès . 6 Dec 2018 . Ludovic . ~8715
1.0.0Web site: GNU Guix 1.0.0 released . Courtès . 2 May 2019 . Ludovic . ~9712
1.0.1Web site: GNU Guix 1.0.1 released . Courtès . 19 May 2019 . Ludovic . ~9771
1.1.0Web site: GNU Guix 1.1.0 released . Courtès . 15 April 2020 . Ludovic . i686, x86_64, armv7, aarch64~13161
1.2.0Web site: GNU Guix 1.2.0 released . Courtès . 23 November 2020 . Ludovic . ~15333
1.3.0Web site: GNU Guix 1.3.0 released . Courtès . 11 May 2021 . Ludovic . i686, x86_64, powerpc64le, armv7, aarch64~17262
1.4.0Web site: GNU Guix 1.4.0 released . Courtès . 19 December 2022 . Ludovic . i686, x86_64, powerpc64le, armv7, aarch64~22000

See also

External links

Notes and References

  1. Web site: GNU Guix Reference Manual. www.gnu.org. 23 April 2018.
  2. Book: Functional Package Management with Guix . Ludovic Courtès . 2013 . . European Lisp Symposium .
  3. Dolstra, E., de Jonge, M. and Visser, E. "Nix: A Safe and Policy-Free System for Software Deployment." In Damon, L. (Ed.), 18th Large Installation System Administration Conference (LISA '04), pages 79–92, Atlanta, Georgia, USA. USENIX, November 2004.
  4. Dolstra, E. The Purely Functional Software Deployment Model. PhD thesis, Faculty of Science, Utrecht, The Netherlands. January 2006. .
  5. Prins, P., Suresh, J. and Dolstra, E., "Nix fixes dependency hell on all Linux distributions," linux.com, December 22, 2008
  6. Hinsen . Konrad . Staged computation: the technique you did not know you were using . July 2020 . Computing in Science and Engineering . 22 . 4 . 99–103 . 10.1109/MCSE.2020.2985508 . 2020CSE....22d..99H . 219990590 . 1558-366X . 2022-11-04.
  7. Vallet . Nicolas . Michonneau . David . Tournier . Simon . Toward practical transparent verifiable and long-term reproducible research using Guix . 4 October 2022 . Scientific Data . 9 . 1 . 597 . 10.1038/s41597-022-01720-9 . 36195618 . 9532446 . 2022NatSD...9..597V . 2052-4463 . 2022-11-04.
  8. What to call Guix? . gnu-system-discuss . 2015-01-15 .
  9. https://www.gnu.org/software/guix/manual/en/html_node/Programming-Interface.html Programming Interface (GNU Guix Reference Manual)
  10. https://www.phoronix.com/scan.php?page=news_item&px=MTIzNjY Guix: A New Package Manager & GNU Distribution - Phoronix
  11. Web site: guix-europe . git.savannah.gnu.org . 16 May 2019 . 24 January 2021 . https://web.archive.org/web/20210124140203/https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/guix-europe . dead .
  12. Web site: Guix - Debian Package Tracker.
  13. Web site: Parabola GNU/Linux-libre - Package Search. 2021-09-14. www.parabola.nu.
  14. Web site: Invoking guix gc . gnu.org . 16 May 2019.
  15. Web site: Invoking guix package . gnu.org . 16 May 2019.
  16. Web site: Invoking guix shell . gnu.org . 22 Nov 2023.
  17. Web site: From 'guix environment' to 'guix shell' . gnu.org . 22 Nov 2023.
  18. Web site: Invoking guix pack . gnu.org . 16 May 2019.
  19. Web site: Invoking guix graph . gnu.org . 16 May 2019.
  20. Stallman . Richard . A GNU Distribution . gnu-system-discuss. 2012-06-05 .
  21. Courtès . Ludovic . Introducing GNU Guix. gnu-system-discuss. 2012-11-23 .
  22. [GSoC update] Porting Guix to GNU/Hurd]. August 20, 2015. August 20, 2015. Manolis. Ragkousis. guix-devel.
  23. Web site: About — GuixSD. www.gnu.org. en. 2018-05-03.