Nix & devenv support
Ideal for atomic linux distributions and macOS setup.
There's one file (devenv.nix
) containing everything that's needed to set up an
environment for the project (packit/deployment
in this case). All tools and
deps are kept only for this project, i.e., they don't pollute the host system.
Since Nix and devenv.sh support pinning, it is also possible to acquire a reproducible environment.
direnv
makes sure the development environment is set up upon entering the repo.
What is Nix?
From the homepage:
Nix is a tool that takes a unique approach to package management and system configuration. Learn how to make reproducible, declarative and reliable systems.
Basically you have global environment and smaller nix-shell
s that are usually
tied to git repos (or any other directory). You aim for as small base environment
as possible, i.e., you don't want to keep all utilities / dependencies everywhere.
One benefit, in comparison to containers, lies in the fact that the packages are
defined by hash, name and version which allows them to be stored in a global
location (usually /nix
). Including packages in “environments” is done by
adjusting $PATH
(and related) variable.
What is devenv.sh?
Builds on top of the Nix and nix-shell themselves. Is a bit more robust,
cause it also allows specifying environment variables, defining tasks, services,
and processes. For example it allows you to automatically spin up nginx
or
postgres
server once you enter the repo.
Getting started
Feel free to follow the devenv.sh' “Getting Started”.
- You need to have Nix set up. (single-user / non-daemon setup is recommended for users with SELinux enabled)
- Install the devenv.sh itself.
- Have direnv present (since it automatically loads the environment upon entering the directory with devenv.sh).
Caveats
Bitwarden CLI is currently broken on macOS, therefore it's not included in the devenv.sh' config.