The Purely Functional Linux Distribution
- Everything we love about Linux in general
- Declarative configuration of nearly everything
- Installation and updates are atomic, easily rolled back
- Boot an older generation if you've completely broken your environment
- Nearly all commands support dry-run modes as well
- Isolated, repeatable development environments
- Easy X11/GPU driver support
- Easy UEFI support
- Easy ZFS support
- Philosophical and technical alignment for Haskell folks
nix-shell
encourages experimentation without "polluting" the system environment- Basically never mutates something in-place
- Inevitable package compatibility problems
- Not with each other, but if no one maintains a Nix package for what you need
- Filesystem layout/mutability assumptions during operation
- Can't just
make install
- Comparatively tiny community
Nix
package manager got a major breaking release earlier this year- Offline installation is iffy
- You hate symlinks
- Might require learning a brand new programming language (c.f. Emacs / Emacs Lisp)
- Updating a package before a maintainer tackles it is not as straightforward
as i.e.
Homebrew
- Some subsets of the
nixpkgs
ecosystem have used a lot of indirection/abstraction (BEAM languages) - Increased network bandwidth and disk space consumed due to isolation/provenance
- Some packages will be compiled from source
- Lives in 1-2 files in
/etc/nixos
(by default)hardware-configuration.nix
(filesystem mounts, swap, kernel modules, initrd payloads)configuration.nix
(basically everything else)
- Test changes locally/immediately, or in a VM for more intrusive/lower-level changes
- Can be versioned, shared, modularized, refactored
System-level configuration:
- Bootloader
- Sound/video/input drivers
- Users, groups, passwords, authorized SSH key, shell, sudo rules
- Networking, firewall
- System packages
- Arbitrary
/etc
files - Arbitrary Systemd units
- Virtualization and containerization
User environment:
- Per-user packages
- Common programs like shells, browsers, GPG, tmux
- Many services plus their configuration (Apache, BIND, Nginx)
- LXC/Docker Containers
- From Docker Hub
- Built locally from Nix
derivations
- Configuration Management
- Packer
- Dockerfiles
- FPM
- Homebrew/Brewfile
- RVM/rbenv/nodenv/pyenv/asdf
The Purely Functional Package Manager
- Uses binary caches (similar to Homebrew
bottles
or traditional Linux packages) when possible - Build packages from source when desired/required
- Not compiled for your platform
- Customized configuration/dependencies
- Checksums used everywhere as part of the packaging syntax
- Cross-platform* packaging
- *if you run Linux/OSX
- Understand the provenance of all of a package's dependencies
- Customize package installation with overrides/overlays
- Packages are naturally isolated from each other
- Multiple concurrent versions installed, without conflict*
- Point-in-time reproducible, if you provide a SHA/timestamp in your
import
- Reformat a machine, replace your old
configuration.nix
and be back in action in however long it takes you to download the packages (sans your stateful homedir data) - Use
nix-copy-closure
to copy the entire-systemderivation
to another NixOS machine, then update itsconfiguration.nix
to match and rebuild for a bit-for-bit identical environment (if you have identical CPU arch)
- Pin an exact release of a given Nix channel and then reproduce (not
bit-for-bit) identical environments on OSX and Linux or across multiple
developers' machines via
nix-shell
- Use an existing Nix/NixOS machine as a hyperlocal cache during installation
using
nix-serve
- Use
nix-shell --pure
to be absolutely certain you've captured/documented all dependencies
- Replace
asdf
withnix-shell
- Use
nix-shell
in a scriptshebang
- Manage your home directory/dotfiles with Nix
- Manage an entire Emacs/Vim environment (including plugins/packages) via Nix
- I found it notably easier/faster to install than ArchLinux
- Installation docs available locally/automatically on TTY 8(?)
- Pre-existing, accurate docs for installing on ZFS root
- First distribution to support my 2017 GPU without tomfoolery
- NixOps (Deploy NixOS instances to AWS, GCP, Azure, Libvirtd)
- Hydra (Nix-based CI tool/build farm)
- Disnix (Distributed systems using Nix)