Getting started
Installation
1. Install Nix
curl -L https://github.com/NixOS/experimental-nix-installer/releases/download/0.27.0/nix-installer.sh | sh -s -- install
Experimental installer
We recommend using the above experimental installer. It can handle OS upgrades and has better support for Apple silicon.
If you'd like to stick with the official release installer, use:
Upgrade Bash
macOS ships with an ancient version of Bash due to licensing reasons.
We recommend installing a newer version from nixpkgs to avoid running into evaluation errors.
2. Install devenv
3. Configure a GitHub access token (optional)
The Nix ecosystem is heavily dependent on GitHub for hosting and distributing source code, like the source for nixpkgs. This means that Nix will make a lot of un-authenticated requests to the GitHub API and you may encounter rate-limiting.
To avoid being rate-limited, we recommend providing Nix with a GitHub access token, which will greatly increase your API limits.
Create a new token with no extra permissions at https://github.com/settings/personal-access-tokens/new.
Add the token to your ~/.config/nix/nix.conf
:
Initial set up
Initialize a new developer environment with devenv init
.
Commands
devenv test
builds your developer environment and makes sure that all checks pass. Useful to run in your continuous integration environment.devenv shell
activates your developer environment.devenv search <NAME>
searches packages matching NAME in Nixpkgs input.devenv update
updates and pins inputs fromdevenv.yaml
intodevenv.lock
.devenv gc
deletes unused environments to save disk space.devenv up
starts processes.
Learn more
- About
.envrc
in Automatic shell activation. - About
devenv.yaml
in Inputs and Composing using imports. - About
devenv.nix
in the Writing devenv.nix section, starting with the basics.
Updating
Update devenv CLI
Update nixpkgs to get the latest version of devenv.
For detailed upgrade instructions specific to your setup, please refer to the documentation for your particular system: NixOS, nix-darwin (for macOS), or home-manager, as applicable.
Update project inputs
Inputs, like nixpkgs and devenv modules, are downloaded and pinned in a devenv.lock
lockfile.
These should be periodically updated with:
Learn more about Inputs.