Skip to content

Getting Started

Here are the minimal steps to get started.

Installation

a) Install Nix

sh <(curl -L https://nixos.org/nix/install) --daemon
sh <(curl -L https://nixos.org/nix/install)
sh <(curl -L https://nixos.org/nix/install) --no-daemon
docker run -it nixos/nix

b) Install Cachix (optional, speeds up the installation by providing binaries)

nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use devenv
nix profile install nixpkgs#cachix
cachix use devenv

c) Install devenv

nix-env -if https://github.com/cachix/devenv/tarball/v0.2
nix profile install github:cachix/devenv/v0.2
configuration.nix
environment.systemPackages = [ 
  (import (fetchTarball https://github.com/cachix/devenv/archive/v0.2.tar.gz))
];
flake.nix
 {
    inputs.devenv.url = "github:cachix/devenv/v0.2";

    outputs = { devenv, ... }: {
        packages = devenv.packages;
    };
}

Initial setup

Given a git repository, create the initial structure:

$ devenv init
Creating .envrc
Creating devenv.nix
Creating devenv.yaml
Appending .devenv* to .gitignore
Done.

Commands

  • devenv ci 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 Search packages matching NAME in nixpkgs input
  • devenv update updates and pins inputs from devenv.yaml into devenv.lock.
  • devenv gc deletes unused environments to save disk space.
  • devenv up starts processes.

Learn more