Skip to content
/ devenv Public

Fast, Declarative, Reproducible, and Composable Developer Environments

License

Notifications You must be signed in to change notification settings

cachix/devenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e8c1b84 · Jan 30, 2025
Jul 4, 2024
Jan 9, 2025
Mar 11, 2024
Jan 28, 2025
Jan 28, 2025
Nov 28, 2024
Jan 29, 2025
Jan 30, 2025
Jan 29, 2025
Jul 9, 2023
Nov 24, 2024
Jan 30, 2025
Nov 13, 2024
Jan 30, 2025
Sep 27, 2024
Mar 11, 2024
Dec 27, 2024
Oct 22, 2024
Apr 21, 2023
Dec 27, 2024
Nov 28, 2024
Jul 3, 2023
Jan 29, 2025
Sep 10, 2024
Nov 16, 2024
Oct 24, 2024
Nov 4, 2022
Dec 17, 2024
Jan 29, 2025
Sep 10, 2024
Dec 27, 2024
Aug 12, 2024
Nov 11, 2024
Jan 19, 2025
Jan 19, 2025
Nov 16, 2024
Aug 1, 2024
Apr 13, 2024
Dec 27, 2024
Apr 13, 2024
Sep 26, 2024
Nov 19, 2024
Apr 13, 2024

Repository files navigation

devenv logo

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

Built with Nix Discord channel License: Apache 2.0 Version CI

Running devenv init generates devenv.nix:

{ pkgs, ... }:

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

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

  enterShell = ''
    hello
  '';

  # https://devenv.sh/tests/
  enterTest = ''
    echo "Running tests"
    git --version | grep --color=auto "${pkgs.git.version}"
  '';

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

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

  # https://devenv.sh/services/
  services.postgres.enable = true;

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

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

And devenv shell activates the environment.

Commands

$ devenv
https://devenv.sh 1.3.1: Fast, Declarative, Reproducible, and Composable Developer Environments

Usage: devenv [OPTIONS] [COMMAND]

Commands:
  init       Scaffold devenv.yaml, devenv.nix, .gitignore and .envrc.
  shell      Activate the developer environment. https://devenv.sh/basics/
  update     Update devenv.lock from devenv.yaml inputs. http://devenv.sh/inputs/
  search     Search for packages and options in nixpkgs. https://devenv.sh/packages/#searching-for-a-file
  info       Print information about this developer environment.
  up         Start processes in the foreground. https://devenv.sh/processes/
  processes  Start or stop processes. https://devenv.sh/processes/
  tasks      Run tasks. https://devenv.sh/tasks/
  test       Run tests. http://devenv.sh/tests/
  container  Build, copy, or run a container. https://devenv.sh/containers/
  inputs     Add an input to devenv.yaml. https://devenv.sh/inputs/
  repl       Launch an interactive environment for inspecting the devenv configuration.
  gc         Delete previous shell generations. See https://devenv.sh/garbage-collection
  build      Build any attribute in devenv.nix.
  direnvrc   Print a direnvrc that adds devenv support to direnv. See https://devenv.sh/automatic-shell-activation.
  version    Print the version of devenv.
  help       Print this message or the help of the given subcommand(s)

Options:
  -V, --version
          Print version information
  -v, --verbose
          Enable additional debug logs.
  -q, --quiet
          Silence all logs
      --log-format <LOG_FORMAT>
          Configure the output format of the logs. [default: cli] [possible values: cli, tracing-full]
  -j, --max-jobs <MAX_JOBS>
          Maximum number of Nix builds at any time. [default: 5]
  -u, --cores <CORES>
          Maximum number CPU cores being used by a single build. [default: 2]
  -s, --system <SYSTEM>
          [default: aarch64-darwin]
  -i, --impure
          Relax the hermeticity of the environment.
      --eval-cache
          Cache the results of Nix evaluation.
      --refresh-eval-cache
          Force a refresh of the Nix evaluation cache.
      --offline
          Disable substituters and consider all previously downloaded files up-to-date.
  -c, --clean [<CLEAN>...]
          Ignore existing environment variables when entering the shell. Pass a list of comma-separated environment variables to let through.
      --nix-debugger
          Enter the Nix debugger on failure.
  -n, --nix-option <NIX_OPTION> <NIX_OPTION>
          Pass additional options to nix commands, see `man nix.conf` for full list.
  -o, --override-input <OVERRIDE_INPUT> <OVERRIDE_INPUT>
          Override inputs in devenv.yaml.
  -h, --help
          Print help (see more with '--help')

Documentation