A Declarative environment with Nix
Package managers
- OS-level: brew, dnf, apt, yum, chocolatey, etc
- Versioning one per runtime: nvm, asdf, rvm, etc
- Per language: go deps, bundler, mix/hex, npm, composer, pip, etc
- Virtual environments: venv
What do we use them for ?
Make an environment for our programs to work !
What do we need ?
- Dependency graph
- Environment
- Services
Reproducible + Repeatable + Easy to change (rollback)
Define all input
- Clean environment (chroot)
- Explicit input
- Full dependency definition
- Symlink results
How does Nix work
- Download the packages in /nix/store, versionned
- Define your environment with code
- Generate a list of packages in your environment
- symlink them
- Keep track of generations, to allow to change the environment easily
Mac
Linux
NixOS
NixPkgs
all you need
Nix-shell
Nix for development environments
- Create a shell.nix file
- define your environment packages and variables
- nix-shell
- Done
Learning
Future Ideas
- Adopt for dev environment ?
- Reproducible test and build environement
- Docker with better caching = faster builds
- Deployment and full control of the deployed boxes
- Your idea !
Thank you !
Questions ?
A Declarative environment with Nix
By di4nao
A Declarative environment with Nix
- 748