Zero to Nix is a highly opinionated learning resource for Nix created by Determinate Systems. We believe Zero to Nix fills a major gap for two reasons:
- We find most of the existing Nix documentation to be difficult to navigate for beginners.
Sources like the Nixpkgs manual, the official website, Nix Pills, and semi-official sources like nix.dev are all great once you have a strong sense of how Nix works and what it provides.
We encourage you to explore them and we even link them in many places in Zero to Nix.
But together they can be daunting to the uninitiated, and we wanted to provide a gentle "front end" to the official documentation sources.
- We strongly believe that flakes are the future of Nix and that people onboarding into Nix should use them from the get-go.
But flakes are currently marked as an experimental feature of Nix and are thus not discussed in any of the official Nix documentation sources (with the exception of the Wiki entry for flakes).
What's opinionated about Zero to Nix
First, as mentioned above, Zero to Nix is opinionated because it advocates learning and using flakes and treating channels as deprecated. But Zero to Nix also deviates from official recommendations in that it recommends installing Nix using Nix Installer rather than the official Nix installation script.
Nix Installer from Determinate Systems differs from the official Nix installation script in several important ways:
- It installs Nix with flake support and the unified CLI feature already enabled rather than requiring users to enable those features.
- It stores a receipt for the install process at
/nix/receipt.json. This receipt enables Nix Installer to seamlessly uninstall Nix, whereas the official Nix installation script provides no offboarding path of this kind.
- Much like Terraform, Nix Installer enables you to plan your installation using the
nix-installer plan command to see how Nix Installer will change your system. We see this as an improvement over the official Nix installation script, which prompts you to approve changes but doesn't present all changes.
- Nix Installer is written in Rust rather than a shell scripting language (the official installer is written in Bash). This has two key benefits:
- It makes Nix Installer more portable across platforms.
- It enables Nix Installer to parallelize CPU-intensive tasks, which can't be achieved in a language like Bash.
- If the installation fails along the way for some reason, Nix Installer can use its receipt to revert the changes that it has made, minimizing the likelihood that the Nix installation process leaves your system in an undesirable state.
There's nothing wrong with the official Nix installation script—far from it!—and we don't dissuade you from using it. But we feel pretty strongly that Nix Installer is more likely to offer a smooth experience for newcomers.