devenv icon indicating copy to clipboard operation
devenv copied to clipboard

Fast, Declarative, Reproducible, and Composable Developer Environments

devenv.sh - Fast, Declarative, Reproducible, and Composable Developer Environments

Join Discord License: Apache 2.0 version CI

logo

Running devenv init generates devenv.nix:

{ pkgs, ... }:

{
  # https://devenv.sh/basics/
  env.GREET = "devenv";

  # https://devenv.sh/packages/
  packages = [ pkgs.git ];

  enterShell = ''
    hello
    git --version
  '';

  # https://devenv.sh/languages/
  languages.nix.enable = true;

  # https://devenv.sh/scripts/
  scripts.hello.exec = "echo hello from $GREET";

  # https://devenv.sh/pre-commit-hooks/
  pre-commit.hooks.shellcheck.enable = true;

  # https://devenv.sh/processes/
  # processes.ping.exec = "ping example.com";
}

And devenv shell activates the environment.

Commands

  • devenv init: Scaffold devenv.yaml, devenv.nix, and .envrc
  • devenv shell: Activate the developer environment
  • devenv shell CMD ARGS: Run CMD with ARGS in the developer environment.
  • devenv update: Update devenv.lock from devenv.yaml inputs. See http://devenv.sh/inputs/#locking-and-updating-inputs
  • devenv up: Starts processes in foreground. See http://devenv.sh/processes
  • devenv gc: Removes old devenv generations. See http://devenv.sh/garbage-collection
  • devenv ci: builds your developer environment and make sure all checks pass.

Documentation