Nix
Nix is a cult providing an Operating System, package manager and a functional language.
How it works
At its core, everything in Nix is declared in code written in the Nix language. From this code, you can build artifacts that end up in the Nix store.
Most often, these artifacts are packages (derivations), but the system goes much further: you can compose entire environments, services, and even whole operating systems.
By rebuilding everything through Nix, you get a reproducible world of software where every build is fully pinned to an exact path in the Nix store, complete with all of its dependencies.
The Nix store then becomes a kind of universe: a place containing every version of every piece of software you’ve ever built (or could build), ready to be referenced, reused, and combined.
Outputs
Think of Nix as a declerative solution space for building anything. There are various things you can build with Nix:
- Packages: a standard derivation is already a basic package, which can produce any set of files:
- Binaries: prebuilt binaries for runtime
- Libraries: shared libraries or codegen
- Documentation: rendered documentation or man pages
- Configuration: evaluated configuration files (eg. ini, json, systemd unit files)
- Data: arbitary runtime data (eg. seclists, certificates)
- Containers: via stdenv build container functions (
.tar.gzOCI images)
- Home Directories: via home-manager
- Systems: NixOS system produces an entire operating system
- Kubernetes Manifests: via kubenix
- Terraform: via terranix
- Websites: via styx
Keep in mind that these are mostly pluggable, it’s all data in the end, so you can compose these how you want and build even more complex or simple abstractions.
Concepts
- Nix Language - The functional programming language powering everything
- Nix Store - The Nix Store, a content and hash addressed path store for files
- Derivation - A unit of computation, a directory stored in the nix store, commonly called a package
- Nix Module - NixOS module system for composing configuration
- Flakes - Repository level subpackaging for nix code
- NixOS - Linux OS built around Nix
Modules
- home-manager - Home directory configuration manager via nix
- disko - Declerative disk partitioning
- stylix - style module for home-manager and nixos
- kubenix - kubernetes manifests using nix
- FlakeParts - composable flake parts library
- lanzaboote - secure boot on nixos
- nixos-hardware - nixos-hardware repository for hardware optimizations
- nixos-facter - automatic nixos hardware recognition and optimizations
- sopsNix - secret management for nix using sops
- Clan - clan machine fleet framework for nix
- munix - micro vm based applications for nix
- Terranix - terraform json builder via nix
- gitignore.nix - gitignores filters for nix
- nixos-generators - generate images from nixos systems
- nixos-raspberrypi - generates nixos systems for raspberry pi
- nixos-images - nixos installer images
- plasma-manager - KDE Plasma Management
Tools
- nixfmt - format nix code
- nixd - nix language server
- attic - self hosted nix binary cache
- nix-alien - run foreign binaries on nixos
- dix - nix diff
- nix-tree - visualize nixpkgs as tree
- nix-index - search for files in binary caches
- nix-output-monitor - prettier nix output
- nixos-anywhere - deploy nixos to remote machines
- devenv - dev environments
- nix-repl - Nix REPL environment
- nix-doc - Nix Documentation
- deadnix - Dead code checker
- statix - Static nix code linting
- styx - Styx Static Site Generator
- comma - run unfetched binaries via nix-index
- nurl - generate nix fetcher expressions from URLs