No description
- Nix 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| examples | ||
| presentation | ||
| .gitignore | ||
| alejandra.toml | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
Why Nix?
This repository is a presentation: a short talk on why we should use Nix dev shells for project development. The slides are markdown files for presenterm.
The talk covers:
- pinning project dependencies (Node.js, Python, Postgres) with a
flake.nix - a shell hook that greets you with the tool versions
- the shell as the documentation of the environment, instead of README setup steps
- downloading an arbitrary zip from the internet, pinned by hash
- a shell script written in the flake that brings its own dependencies
- how the Nix store works, and why per-project shells keep your system clean
- running any package once with
nix run nixpkgs#<package> - why a dev shell does not replace Docker
Run it
You only need Nix with flakes enabled. The dev shell of this repository is
also the example the talk builds up to, and it ships presenterm:
nix develop
presenterm presentation/en.md
Add -x to allow running the +exec snippets live from the slides:
presenterm -x presentation/en.md
Layout
.
+- flake.nix the full example shell (plus presenterm)
+- examples/
| +- 01-versions/ pinned Node.js, Python and Postgres
| +- 02-shell-hook/ the same shell, printing versions on entry
| +- 03-fetch-zip/ a zip from the internet, pinned by hash
| +- 04-shell-script/ a script that carries its own dependencies
+- presentation/
+- en.md English slides
Every flake is written with flake-parts, so one definition covers Linux and macOS on both x86_64 and aarch64.
Each example is a standalone flake you can enter directly:
nix develop ./examples/02-shell-hook