作品
GNU Guix系統
GNU Guix System
GNU作業系統的進階散佈版
在包含此条目的事件档案中探索信息与关系。
还没有包含此条目的事件档案。
从此条目开始调查GNU作業系統的進階散佈版
GNU Guix (; portmanteau of Guile and Nix) is a functional programming cross-platform package manager and a tool to instantiate and manage Unix-like operating systems, inspired by 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.
Differing from traditional package managers, Guix (like Nix) uses a purely functional programming deployment model where software is installed into unique directories generated through cryptographic hash functions. All dependencies for each software are included in the input of each hash. This solves the problem of dependency hell, allowing multiple versions of the same software to coexist which makes packages portable and reproducible. Performing scientific computations in a Guix setup has been proposed as a promising response to the replication crisis.
The development of GNU Guix is intertwined with the GNU Guix System, an installable operating system distribution using the Linux-libre kernel and the GNU Shepherd init system.
Guix packages are defined through functional Guile Scheme APIs designed for package management. Dependencies are tracked directly in this language through special values named "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 needs, all upgrades in Guix are guaranteed to be 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 package managers, since it requires an unorthodox approach to how the system should function (see MicroOS). However, the Guix package manager, like Nix, can be used on many distributions like Debian and Parabola. 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, an even larger amount of storage space and bandwidth is required.
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.
Guix - like Nix - has built-in garbage collection facilities to help prune dead store items and keep the live ones.
This is an example of a package definition for the hello-package:
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.
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.
Guix package uses profiles generations, which are a collection of symbolic links (also known as "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. For example, 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. On version c087a90e06d7b9451f802323e24deb1862a21e0f of Guix, this corresponds to the item: /gnu/store/md2plii4g5sk66wg9cgwc964l3xwhrm9-hello-2.10 (built from the recipe above).
In addition to symbolic links, each profile that Guix builds also contains a union of all the info-manuals, and the man pages, icons, fonts, etc., so a user can browse documentation and have access to all the icons and fonts installed. The default symbolic links to profile generations are stored under /var/guix.
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.
Guix package enables instantaneous roll-back to a previous profile generation via changing the symlink to an earlier profile generation. 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).
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 user's default profile with dependencies for multiple projects.
E.g., running guix shell --development hello enters a throw-away environment where everything needed to compile hello on Guix is present (GNU Compiler Collection (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.
If a user wants a persistent gc-rooted environment that is not garbage collected on the next run of the Guix garbage collector they can create a root: e.g. running guix shell --root=hello-root --devel
来源:GNU Guix (CC BY-SA)
结构化信息、用户意见与 AI 提取的关系会分别标注。
等待第一条评论。
按日期整理关联何时出现、何时改变。来自动态帖子与来源中的日期。
GNU Guix系統 原作 GNU/Hurd