devenv-hook(1)

πŸ“¦
version 2.4.0 Β· 2 versions
, in nixpkgs unstable

πŸ’… devenv-hook(1) β€” like, the shell hook page, bestie

okay so real quick: this is the devenv-hook(1) page from the General Commands Manual section, and it's genuinely one of the most useful little gremlins in the whole toolbox. sit down, grab a strawberry πŸ“, and let's get into it.


✨ NAME ✨

devenv-hook β€” prints the shell hook that auto-activates when you cd into a directory. that's it. that's the whole vibe. no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

devenv hook [--user-config] [--from] [-o|--override-input] [-O|--option]
[-j|--max-jobs] [-u|--cores] [-s|--system] [-i|--impure] [--no-impure]
[--offline] [--nix-option] [--nix-debugger] [-c|--clean] [-P|--profile]
[--reload] [--no-reload] [--shell] [--eval-cache] [--no-eval-cache]
[--refresh-eval-cache] [--refresh-task-cache] [--secretspec-provider]
[--secretspec-profile] [--trace-to] [-v|--verbose] [-q|--quiet] [--tui]
[--no-tui] [-h|--help] <SHELL> [SHELL_ARGS]

🌸 DESCRIPTION 🌸

Print shell hook for auto-activation on directory change. that's literally the job. it prints a hook, your shell sources it, and then the universe just knows when you've walked into a devenv project. main character energy honestly πŸ‘‘

⚠️ important detail before you go feral: arguments for the activated devenv shell must come after --. for example:

devenv hook fish -- --no-tui | source

fish and nushell load this automatically when devenv is installed via Nix. slay. but if it's not loading for you πŸ‘€:

fish:    devenv hook fish | source       # in ~/.config/fish/config.fish
nushell: mkdir ($nu.default-config-dir | path join autoload); devenv hook nu | save --force ($nu.default-config-dir | path join autoload/devenv-hook.nu)
the nushell one is a whole sentence, i know 😭 but it's just: make the autoload dir, then save the hook into autoload/devenv-hook.nu. copy it exactly, don't freelance.

Bash and zsh have no equivalent β€” so you genuinely always have to add this to your shell config yourself. no automatic anything. you're on your own, bestie 🫢:

bash:    eval "$(devenv hook bash)"     # in ~/.bashrc
zsh:     eval "$(devenv hook zsh)"      # in ~/.zshrc

πŸŽ€ OPTIONS πŸŽ€

  • --user-config <USER_CONFIG> β€” use this user configuration file instead of the XDG default. it's giving ✨customization✨
  • <SHELL> β€” the shell you want a hook for. possible values, and yes you must pick one:
    • bash
    • zsh
    • fish
    • nu
  • [SHELL_ARGS] β€” arguments forwarded verbatim to the activated devenv shell. verbatim verbatim. character for character. don't expect it to be clever about them πŸ’…

🌈 INPUT OVERRIDES 🌈

  • --from <FROM> β€” source for devenv.nix.

can be either a filesystem path (with the path: prefix) or a flake input reference.

examples, because examples ate:

--from github:cachix/devenv
--from github:cachix/devenv?dir=examples/simple
--from path:/absolute/path/to/project
--from path:./relative/path
  • -o, --override-input <NAME> <URI> β€” override inputs in devenv.yaml.

examples:

--override-input nixpkgs github:NixOS/nixpkgs/nixos-unstable
--override-input nixpkgs path:/path/to/local/nixpkgs
  • -O, --option <OPTION:TYPE> <VALUE> β€” override configuration options with typed values. typed!! no vibes-based type guessing here πŸ”₯

OPTION must include a type: <attribute>:<type>. supported types are: string, int, float, bool, path, pkg, pkgs.

list types (pkgs) append to existing values by default. add a ! suffix to replace instead: pkgs!. lowkey the most important ! in your life.

examples:

--option languages.rust.channel:string beta
--option services.postgres.enable:bool true
--option languages.python.version:string 3.10
--option packages:pkgs "ncdu git"       (appends to packages)
--option packages:pkgs! "ncdu git"      (replaces all packages)

⭐ NIX OPTIONS ⭐

  • -j, --max-jobs <MAX_JOBS> β€” maximum number of Nix builds to run concurrently.

defaults to 1/4 of available CPU cores (minimum 1). yeah, a quarter. it's being polite.

  • -u, --cores <CORES> β€” number of CPU cores available to each build.

defaults to available cores divided by max-jobs (minimum 1).

  • -s, --system <SYSTEM> β€” override the target system.

defaults to the host system (e.g. aarch64-darwin, x86_64-linux).

  • -i, --impure β€” relax the hermeticity of the environment. chaos (affectionate) πŸŒͺ️
  • --no-impure β€” force a hermetic environment, overriding config. back in the box you go πŸ”’
  • --offline β€” disable substituters and consider all previously downloaded files up-to-date.
  • --nix-option <NAME> <VALUE> β€” pass additional options to nix commands.

these options are passed directly to Nix using the --option flag. see man nix.conf for the full list of available options.

examples:

--nix-option sandbox false
--nix-option keep-outputs true
--nix-option system x86_64-darwin
  • --nix-debugger β€” enter the Nix debugger on failure. scary but iconic πŸ’€

🧚 SHELL OPTIONS 🧚

  • -c, --clean [<CLEAN>...] β€” ignore existing environment variables when entering the shell. pass a list of comma-separated environment variables to let through. ✨selective memory✨
  • -P, --profile <PROFILES> β€” activate one or more profiles defined in devenv.nix.

profiles let you define different configurations that can be merged with your base configuration.

see https://devenv.sh/profiles for more information.

examples:

--profile python-3.14
--profile backend --profile fast-startup
  • --reload β€” enable auto-reload when config files change (default).
  • --no-reload β€” disable auto-reload when config files change.
  • --shell <SHELL_TYPE> β€” shell to use for interactive sessions (bash, zsh, fish, nu).

possible values:

  • bash
  • zsh
  • fish
  • nu

πŸ“ CACHE OPTIONS πŸ“

  • --eval-cache β€” enable caching of Nix evaluation results (default).
  • --no-eval-cache β€” disable caching of Nix evaluation results.
  • --refresh-eval-cache β€” force a refresh of the Nix evaluation cache.
  • --refresh-task-cache β€” force a refresh of the task cache. shake it out 🫨

πŸ” SECRETSPEC OPTIONS πŸ”

  • --secretspec-provider <SECRETSPEC_PROVIDER> β€” override the secretspec provider.
  • --secretspec-profile <SECRETSPEC_PROFILE> β€” override the secretspec profile.

πŸ‘‘ TRACING OPTIONS πŸ‘‘

  • --trace-to <TRACE_TO> β€” enable tracing and set output destination(s). can be repeated for multiple outputs.

syntax: [format:]destination

examples:

--trace-to stderr                              # json to stderr
--trace-to pretty:stderr                       # pretty format to stderr
--trace-to json:file:/tmp/trace.json           # JSON to file
--trace-to otlp-grpc                           # OTLP gRPC to default endpoint
--trace-to otlp-grpc:http://collector:4317     # OTLP gRPC to custom endpoint

multiple outputs:

--trace-to pretty:stderr --trace-to json:file:/tmp/t.json

destinations: stdout, stderr, file:<path>, http(s)://<host>:<port>. formats: json (default), pretty, full, otlp-grpc, otlp-http-protobuf, otlp-http-json.

when format is omitted, defaults to json. tracing is disabled by default.

[env: DEVENV_TRACE_TO=] (comma-separated)

[env: DEVENV_TRACE_DEFAULT_TO=] (comma-separated, used only when no explicit tracing is configured; set to empty string to suppress) πŸ™ˆ


πŸ’œ GLOBAL OPTIONS πŸ’œ

  • -v, --verbose β€” enable additional debug logs. wordy era πŸ—£οΈ
  • -q, --quiet β€” silence all logs. 🀫
  • --tui <TUI> β€” enable the interactive terminal interface (default when interactive).

possible values:

  • true
  • false
  • --no-tui β€” disable the interactive terminal interface.
  • -h, --help β€” print help (see a summary with '-h').

aaaand that's the page, bestie πŸŽ€ every flag, every default, every env var, every example β€” all accounted for, nothing skipped, no cap. this one's filed under the hook section of devenv-hook(1) in the General Commands Manual, so if you ever need to cite it in an argument you're so covered. go forth and auto-activate πŸ’–βœ¨

πŸ“¦ where this page comes from