wiki/notebook/tools.nix.org
Gabriel Arazas 5242780327 Revise Nix-related notes
Added more notes as I developed the Guix overlay for NixOS over time. It
does have a nice experience, overall (albeit clunky one due to the documentation).
2022-10-25 16:58:19 +08:00

3.6 KiB

Nix package manager

Nix is a package manager that pioneered Functional package management which addresses the criticisms of traditional Unix systems while making it as a specialized tool for Reproducible builds. It features a handrolled configuration language (also called Nix) that leans into functional paradigm, making it easier if you have experience on it. A popular tool mostly featured in Haskell programming projects.

Eventually inspired GNU to create a fork, Guix package manager, that takes it to another direction with more focus on reproducibility and its extensions such as bootstrapping.

Among other things, Nix also has the following features to look out for.

Ecosystem

The basic ropes into getting started with Nix.

  • nixpkgs is the official package set similar to Flathub for Flatpak. In terms of size, nixpkgs is comparable to AUR.
  • NUR is the user-contributed Nix packages curated by the community. While most of the packages can be passed into nixpkgs, most of them are niche packages (or the package author are not interested in maintaining it).
  • direnv has integration with Nix as well as a lot of editors.
  • lorri replaces nix-shell integrating with direnv.
  • niv provides a easier way to manage dependencies though it will be easier with Nix flakes.
  • Nix flakes is an upcoming feature for Nix, replacing the traditional Nix channels into a decentralized set of derivations that can be retrieved from anywhere similar to Go modules 1.
  • Cachix is a cache service enabling to easily distribute binaries built with Nix.
  • DevOS is a configuration framework for deploying NixOS-based systems.

Components of the package manager

Holistically, Nix is made up of at least four components: the store, the language, the derivations, and the sandbox.

  • The store is a immutable centralized location where all of the outputs are placed.
  • The derivations are essentially build instructions.
  • Nix language is a domain-specific language for creating derivations.
  • The build process can be locked in a sandbox, improving the reproducibility of a setup and lowering the attack surface for a malicious package.

1

At a glance, anyways. I'm not experienced enough with Go to say that with utmost confidence.