Nix explained from the ground up
Surma Surma
1.47K subscribers
24,589 views
1.9K

 Published On Sep 6, 2024

(CORRECTIONS IN THE DESCRIPTION)

What is Nix? And how does it build software in a completely deterministic way?

Chapters:
0:00 - Intro
0:45 - How Nix came to be
3:37 - Install Nix
4:13 - Nix Language speedrun
7:23 - builtins
8:09 - Paths and the Nix store
9:52 - Derivations
17:25 - Nixpkgs
18:05 - Remote Caches & dependency trees
19:30 - stdenv
22:03 - lib
22:30 - NixOS
22:58 - Outro

Corrections:
- Paths only get expanded to their store path during string interpolation (i.e. `${./my-file.txt}`). `builtins.toString` does not do that. (Thanks @tejing2001)
- My example of using the system’s compiler only worked because MacOS does not provider proper containerization. On Linux you are (more) safe from accidentally writing an impure derivation. (Thanks @tejing2001)
- buildPhase, installPhase (and other phases) have hooks that need to be invoked from the script you provide. I did not do that and it is usually a mistake. Details about the phases and their hooks is in the nixpkgs manual (Thanks @tejing2001).

Resources:
PhD Thesis: https://edolstra.github.io/pubs/phd-t...
Nix & NixOS: https://nixos.org
Nixpkgs manual: https://nixos.org/manual/nixpkgs/stable/
Package manager graphs: https://repology.org/repositories/graphs
Noogle: https://noogle.dev/
Nixpkgs search: https://search.nixos.org/packages
Nix flakes: https://nixos.wiki/wiki/Flakes
Cachix: https://www.cachix.org/
Home Manager: https://nix-community.github.io/home-...
Nix pills: https://nixos.org/guides/nix-pills/

Music: “Good Night” by FASSSound
https://pixabay.com/music/beats-good-...

Video software:
Motion Canvas: https://motioncanvas.io/

show more

Share/Embed