Jump to content

GNU Guix

From Wikipedia, the free encyclopedia
GNU Guix
Stable release
1.4.0[1] Edit this on Wikidata / 19 December 2022; 20 months ago (19 December 2022)
Repository
Written inGuile Scheme, C++ (Nix core)
LicenseGPLv3+
Websiteguix.gnu.org/en/

GNU Guix (/ɡks/[2]) 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.[3]

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.[4][5] This solves the problem of dependency hell,[6] 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.[7][8]

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

General features

[edit]

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.[13][14] 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

[edit]

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

[edit]

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

Package definitions

[edit]

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

[edit]

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

[edit]

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

[edit]

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

Roll-back

[edit]

Guix package enables instantaneous roll-back to a previous profile generation via changing the symlink to an earlier profile generation.[16] 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

[edit]

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.[17]

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

Without the --development flag, only the package hello would be installed and not its build-dependencies. This supplants the guix environment 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.[18]

Persistent development environment

[edit]

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 guix shell --root=hello-root --development hello 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

[edit]

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

Graph

[edit]

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

Guix System (operating system)

[edit]
Guix System
Guix System running Xfce, GNU IceCat and GNU Emacs
DeveloperGNU Project[21][22]
OS familyLinux (Unix-like)
Working stateCurrent[23]
Source modelFree software, FSDG
Latest release1.4.0[24] Edit this on Wikidata / 19 December 2022; 20 months ago (19 December 2022)
Repository
Marketing targetDesktop
Package managerGNU Guix
Platformsx86_64, i686, aarch64, armv7, powerpc64le
Kernel typeMonolithic: Linux-libre (operational) Microkernel: GNU Hurd (under development)
UserlandGNU
LicenseGPL
Official websiteguix.gnu.org

GNU Guix System or Guix System[25][26] (previously known as GuixSD[27]) is a rolling release, free and open source Linux distribution built around Guix, similar to how NixOS is built around Nix.[28][29] It enables a declarative operating system configuration[30] and allows system upgrades that the user can rollback.[31] It uses the GNU Shepherd init system[32][33] and the Linux-libre kernel, with the support of the GNU Hurd kernel under development.[34] On February 3, 2015, the Free Software Foundation added the distribution to its list of endorsed free Linux distributions.[35]

Architecture support

[edit]

The following CPU architectures are supported at the moment:[36]

System services

[edit]

System services, which are defined in the Guile Scheme,[39] enable the user to declaratively compose the configuration of daemons and background services and specify configurations. This enables the user, within a single configuration file or modularized configuration, to configure the whole operating system (e.g., to have a Tor proxy, an ssh server, and a webserver serving guix-web via nginx on a specific port at bootup). They can:[40]

  • generate files in the filesystem (needed by some applications e.g. files in /etc)
  • run any code for setting up daemons
  • create specific user and group accounts (e.g. a database user for PostgreSQL)

GNU Shepherd init system

[edit]

The Guix System uses the GNU Daemon Shepherd, formerly known as "dmd" ("Daemon managing Daemons"), as its init system, which is developed in tandem with Guix and is written and configurable in Guile.[41] It supplies user-space functionality asynchronously as services, which under Shepherd are generic functions and object data types which it uses to extend the base operating system in a defined way. In contrast to systemd, a userspace shepherd process runs as the user. Central to the Shepherd model of user space initialization is the concept of the extension, a form of composability whereby services are designed to be layered onto other services, augmenting them with more elaborate or specialized behaviours as desired.[42] This expresses the instantiation-based dependency relationships found in many modern init systems,[43] making the system modular, but also allows services to interact variadically with other services in arbitrary ways, e.g. a service that extends two other services, requiring only one to be present, but readily extending the second one if it is later instantiated without the need for any further reconfiguration or setup.

Shepherd also provides virtual services which allow dynamic dispatch over a class of related service objects, such as all those which instantiate a mail transfer agent (MTA) for the system.[44] A system governed via the Shepherd daemon can represent its user space as a directed acyclic graph, with the "system-service," which is responsible for early phases of boot and init, as its root, and all subsequently initialized services as extensions to system-service functionality, either directly or transitively over other services.[42][45]

It is intended to be highly programmable by the system administrator using Guile, but it can also be used to manage per-user profiles of unprivileged daemons and services.[46] Its services and configuration are stored uniformly as object-oriented Scheme code, and while a core set of services are provided with the basic Guix System,[47] arbitrary new services can be flexibly declared, and through Guile's object system, GOOPS, existing services can be redefined at the user's discretion by asking the Shepherd to dynamically rewrite services in specified ways on instantiation.[48][49]

GNU Shepherd was originally designed to work with GNU Hurd, and was later adopted by Guix System.[50]

Roll-back

[edit]

Similar to the roll-back feature of Guix, if a system update leaves users with a broken system, users can easily roll back individual packages as well as the whole system state with a simple command:
guix package --roll-back[51]
This means that the kind of stable channel that is very common in other Linux distributions is no longer needed for users who are willing to report a bug and wait a few minutes, when trying to update via guix pull. This is accomplished by a combination of Guix's functional package manager, which treats each package and system configuration as an immutable and reproducible entity,[52] and the generation system which maintains a history of system configurations as "generations." These generations are stored as separate profiles, which allow you to roll back to any previous configuration,[53] and you can see these generations with
guix package --list-generations.

Reception

[edit]

Jesse Smith from DistroWatch Weekly reviewed GNU Guix System 0.15.0 (at the time named GuixSD), and said, "GuixSD has a package manager that I like", but criticized the limited hardware support and its limited documentation.[54] The documentation has since then been expanded and improved with videos[55] and a cookbook[56] in six languages with tutorials, how-to guides and examples.

History

[edit]

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

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.[58]

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

Releases

[edit]

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

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

See also

[edit]

References

[edit]
  1. ^ Ludovic Courtès (19 December 2022). "GNU Guix 1.4.0 released". Retrieved 21 December 2022.
  2. ^ "GNU Guix Reference Manual". www.gnu.org. Retrieved 23 April 2018.
  3. ^ Ludovic Courtès (2013). Functional Package Management with Guix. Madrid, Spain: European Lisp Symposium.
  4. ^ 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.
  5. ^ Dolstra, E. The Purely Functional Software Deployment Model. PhD thesis, Faculty of Science, Utrecht, The Netherlands. January 2006. ISBN 90-393-4130-3.
  6. ^ Prins, P., Suresh, J. and Dolstra, E., "Nix fixes dependency hell on all Linux distributions," Archived December 26, 2008, at the Wayback Machine linux.com, December 22, 2008
  7. ^ Hinsen, Konrad (July 2020). "Staged computation: the technique you did not know you were using". Computing in Science and Engineering. 22 (4): 99–103. Bibcode:2020CSE....22d..99H. doi:10.1109/MCSE.2020.2985508. ISSN 1558-366X. S2CID 219990590. Retrieved 2022-11-04. Open access icon
  8. ^ Vallet, Nicolas; Michonneau, David; Tournier, Simon (4 October 2022). "Toward practical transparent verifiable and long-term reproducible research using Guix" (PDF). Scientific Data. 9 (1): 597. Bibcode:2022NatSD...9..597V. doi:10.1038/s41597-022-01720-9. ISSN 2052-4463. PMC 9532446. PMID 36195618. Retrieved 2022-11-04. Open access icon
  9. ^ "What to call Guix?" (Mailing list). gnu-system-discuss. 2015-01-15.
  10. ^ Programming Interface (GNU Guix Reference Manual)
  11. ^ Guix: A New Package Manager & GNU Distribution - Phoronix
  12. ^ "guix-europe". git.savannah.gnu.org. Archived from the original on 24 January 2021. Retrieved 16 May 2019.
  13. ^ "Guix - Debian Package Tracker".
  14. ^ "Parabola GNU/Linux-libre - Package Search". www.parabola.nu. Retrieved 2021-09-14.
  15. ^ "Invoking guix gc". gnu.org. Retrieved 16 May 2019.
  16. ^ "Invoking guix package". gnu.org. Retrieved 16 May 2019.
  17. ^ "Invoking guix shell". gnu.org. Retrieved 22 Nov 2023.
  18. ^ "From 'guix environment' to 'guix shell'". gnu.org. Retrieved 22 Nov 2023.
  19. ^ "Invoking guix pack". gnu.org. Retrieved 3 September 2024.
  20. ^ "Invoking guix graph". gnu.org. Retrieved 16 May 2019.
  21. ^ "About — GuixSD". gnu.org. Archived from the original on April 12, 2017. Retrieved March 16, 2017.
  22. ^ "GNU/Linux FAQ - GNU Project - Free Software Foundation". Free Software Foundation. Archived from the original on September 7, 2013. Retrieved 2017-05-14.
  23. ^ "Download — GNU Guix". Archived from the original on August 1, 2020. Retrieved 2019-11-03.
  24. ^ Ludovic Courtès (19 December 2022). "GNU Guix 1.4.0 released (English)". Retrieved 30 December 2022.
  25. ^ "About — GNU Guix". guix.gnu.org. Retrieved 2021-12-11.
  26. ^ "Free GNU/Linux distributions". www.gnu.org.
  27. ^ "What to call Guix?" (Mailing list). gnu-system-discuss. 2015-01-15. Archived from the original on August 7, 2020. Retrieved August 3, 2020.
  28. ^ "List of Free GNU/Linux Distributions". www.gnu.org. Archived from the original on July 6, 2020. Retrieved February 3, 2015.
  29. ^ "Guix: A New Package Manager & GNU Distribution". Phoronix. Archived from the original on February 2, 2015. Retrieved February 3, 2015.
  30. ^ "Using the Configuration System". www.gnu.org. Archived from the original on April 29, 2019. Retrieved 27 April 2019.
  31. ^ "Package Management". www.gnu.org. Archived from the original on May 21, 2019. Retrieved 27 April 2019.
  32. ^ "Programming Interface (GNU Guix Reference Manual)". guix.gnu.org. Archived from the original on August 7, 2020. Retrieved 2020-08-03.
  33. ^ "Guix: A New Package Manager & GNU Distribution - Phoronix". www.phoronix.com. Archived from the original on July 6, 2018. Retrieved 2020-08-03.
  34. ^ "GNU Guix & GuixSD 0.12.0 released" (Mailing list). guix-devel. 2016-12-21. Archived from the original on August 1, 2020. Retrieved August 3, 2020.
  35. ^ "FSF adds Guix System Distribution to list of endorsed distributions". Free Software Foundation. 3 February 2015. Archived from the original on February 3, 2015. Retrieved February 3, 2015.
  36. ^ "Download". gnu.org. Archived from the original on October 6, 2021. Retrieved 12 January 2024.
  37. ^ Mathieu Othacehe. "Porting GuixSD to ARMv7". Archived from the original on December 25, 2017. Retrieved February 17, 2018.
  38. ^ Marusich, Chris; Le Bouter, Léo (April 12, 2021). "New Supported Platform: powerpc64le-linux". Archived from the original on May 16, 2021. Retrieved October 6, 2021.
  39. ^ "guix.git". git.savannah.gnu.org. Archived from the original on May 11, 2019. Retrieved 11 May 2019.
  40. ^ Wurmus, Ricardo. "Re: Help with preparing to move from Arch Linux to Guix" (Mailing list). Archived from the original on August 1, 2020. Retrieved 11 May 2019.
  41. ^ "guix-devel mailing lists". Archived from the original on September 19, 2019. Retrieved 2016-11-05.
  42. ^ a b "GNU Guix Reference Manual: Service Composition". GNU Project. Archived from the original on January 1, 2019. Retrieved 2016-11-05.
  43. ^ "systemd: Unit Dependencies and Order". Fedora Magazine. November 25, 2015. Archived from the original on August 1, 2020. Retrieved 2016-11-05.
  44. ^ "The GNU Shepherd Manual: Jump Start". GNU Project. Archived from the original on August 1, 2020. Retrieved 2016-11-05.
  45. ^ "GNU Guix Reference Manual: Shepherd Services". GNU Project. Archived from the original on January 1, 2019. Retrieved 2016-11-05.
  46. ^ "The GNU Shepherd Manual". GNU Project. Archived from the original on August 1, 2020. Retrieved 2016-11-05.
  47. ^ "GNU Guix Reference Manual: Services". GNU Project. Archived from the original on December 25, 2018. Retrieved 2016-11-05.
  48. ^ "GNU Guix Reference Manual: Service Types and Services". GNU Project. Archived from the original on January 5, 2019. Retrieved 2016-11-05.
  49. ^ "GNU Guix Reference Manual: Using the Configuration System". GNU Project. Archived from the original on April 29, 2019. Retrieved 2016-11-05.
  50. ^ "GNU Shepherd". GNU project. Archived from the original on February 12, 2016. Retrieved 2016-02-12.
  51. ^ "Invoking guix system". www.gnu.org. Archived from the original on May 26, 2019. Retrieved 27 April 2019.
  52. ^ Courtès, Ludovic (2013). "Functional Package Management with Guix". p. 2. arXiv:1305.4584 [cs.PL].
  53. ^ "Multi-dimensional transactions and rollbacks, oh my!". guix.gnu.org.
  54. ^ Smith, Jesse. "Guix System Distribution 0.15.0 and ReactOS 0.4.9". distrowatch.com (778). Archived from the original on July 30, 2019. Retrieved 2018-08-30.
  55. ^ "Videos". Archived from the original on August 1, 2020. Retrieved 2020-03-03.
  56. ^ "Cookbook". Archived from the original on August 1, 2020. Retrieved 2020-03-03.
  57. ^ Stallman, Richard (2012-06-05). "A GNU Distribution" (Mailing list). gnu-system-discuss.
  58. ^ Courtès, Ludovic (2012-11-23). "Introducing GNU Guix" (Mailing list). gnu-system-discuss.
  59. ^ Ragkousis, Manolis (August 20, 2015). "[GSoC update] Porting Guix to GNU/Hurd" (Mailing list). guix-devel. Retrieved August 20, 2015.
  60. ^ "About — GuixSD". www.gnu.org. Retrieved 2018-05-03.
[edit]