GithubHelp home page GithubHelp logo

cachix / devenv Goto Github PK

View Code? Open in Web Editor NEW
4.0K 26.0 296.0 3.19 MB

Fast, Declarative, Reproducible, and Composable Developer Environments

Home Page: https://devenv.sh

License: Apache License 2.0

Nix 75.54% Dockerfile 0.51% Shell 1.71% Rust 22.12% JavaScript 0.11%
developer-tools development-environment

devenv's Introduction

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/pre-commit-hooks/
  pre-commit.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.0.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.
  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/
  gc         Deletes previous shell generations. See http://devenv.sh/garbage-collection
  build      Build any attribute in devenv.nix.
  version    Print the version of devenv.
  help       Print this message or the help of the given subcommand(s)

Options:
  -v, --verbose
          Enable debug log level.
  -j, --max-jobs <MAX_JOBS>
          Maximum number of Nix builds at any time. [default: 8]
  -j, --cores <CORES>
          Maximum number CPU cores being used by a single build.. [default: 2]
  -s, --system <SYSTEM>
          [default: x86_64-linux]
  -i, --impure
          Relax the hermeticity of the environment.
  -c, --clean [<CLEAN>...]
          Ignore existing environment variables when entering the shell. Pass a list of comma-separated environment variables to let through.
  -d, --nix-debugger
          Enter 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

Documentation

devenv's People

Contributors

ankhers avatar atry avatar bobvanderlinden avatar brandonhamilton avatar cdmistman avatar dependabot[bot] avatar domenkozar avatar github-actions[bot] avatar imincik avatar k3yss avatar kwbauson avatar matthiasdebernardini avatar mcdonc avatar midchildan avatar msbarbieri avatar oscar-izval avatar penguincoder avatar roberth avatar samjwillis97 avatar sandydoo avatar sestrella avatar shyim avatar sidux avatar sixhobbits avatar stephank avatar theesm avatar thenonameguy avatar totoroot avatar worktheclock avatar zimbatm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devenv's Issues

zsh support

Especially when used with direnv - it'd be nice to keep a similar UX to what plain Nix with flakes does.

devenv:

image

direnv with flakes:

image

dev stderr error

✦ ❯ devenv init
Creating .envrc
Creating devenv.nix
Creating devenv.yaml
Appending .devenv* to .gitignore
Done.
direnv: loading /workspace/empty/.envrc
/home/gitpod/.nix-profile/bin/devenv: line 67: /dev/stderr: Permission denied

I guess one of these lines are triggering it

devenv/src/devenv.nix

Lines 65 to 66 in 5ec1d75

echo Starting processes ... >> /dev/stderr
echo >> /dev/stderr

Error when inside directories with spaces

If anywhere in the pwd path there is a directory with spaces, I get an ambiguous redirect error for the $DEVENV_DIR variable. Renaming the directory to something without spaces does make it work, though that's not the best solution

/home/andersmmg/.nix-profile/bin/devenv: line 25: $DEVENV_DIR/devenv.json: ambiguous redirect

Consider cross-platform userspace process orchestrator for process management

To avoid reimplementing common service requirements (wait until postgres is ready to launch dependent services) I recommend taking a look at generating the data structure of https://github.com/F1bonacc1/process-compose and use it provide an alternative devenv up command.

Nix is perfect for supplying the binaries, the startup/shutdown scripts can be added as devenv scripts and the execution/scheduling can be handed off to this new opt-in(?) process-compose binary.

I've been developing with it via the classic Nix Flake + direnv + process-compose and it is the perfect docker-compose replacement.
I would be open to contributing to this, if the idea seems acceptable to the maintainers.

stack trace after initializing devenv

Loaded devenv via flake (main branch), then:

dream2nix on  main [$] via ❄️  impure (dream2nix-devshell)
❯ rm -rf .envrc
direnv: unloading

dream2nix on  main [$✘]
❯ devenv init
Creating .envrc
Creating devenv.nix
Creating devenv.yaml
Appending .devenv* and devenv.local.nix to .gitignore
Done.
direnv: error /home/grmpf/synced/projects/github/dream2nix/.envrc is blocked. Run `direnv allow` to approve its content

dream2nix on  main [$!?]
❯ direnv allow
direnv: loading ~/synced/projects/github/dream2nix/.envrc
Building shell ...
[21.9/0.3 MiB DL] downloading 'https://github.com/NixOS/nixpkgs/archive/3a86856a13c88c8c64ea32082a851fefc79aa700.zip'direnv: ([/nix/store/a5kmn3sij0dlkxy5xxv7drs08k0qp267-direnv-2.31.0/bin/direnv export fish]) is taking a while to execute. Use CTRL-C to give up.
warning: creating lock file '/home/grmpf/synced/projects/github/dream2nix/devenv.lock'
deadnix 0.1.8
cachix 1.0.1
statix 0.5.6
vulnix 1.10.1
✨ devenv is out of date. Please update to 0.2: https://devenv.sh/getting-started/#installation
pre-commit-hooks.nix: updating /home/grmpf/synced/projects/github/dream2nix repo
pre-commit uninstalled
pre-commit installed at .git/hooks/pre-commit
hello from devenv
git version 2.38.1
direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +DETERMINISTIC_BUILD +DEVENV_DOTFILE +DEVENV_ROOT +DEVENV_STATE +GREET +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_STORE +NM +OBJCOPY +OBJDUMP +PYTHONHASHSEED +PYTHONNOUSERSITE +PYTHONPATH +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +TMPDIR +_PYTHON_HOST_PLATFORM +_PYTHON_SYSCONFIGDATA_NAME +buildInputs +buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +dontAddDisableDepTrack +mesonFlags +name +nativeBuildInputs +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS

dream2nix on  main [$!?] via ❄️  impure (devenv)
❯ devenv --help
https://devenv.sh (version 0.2): Fast, Declarative, Reproducible, and Composable Developer Environments

Usage: devenv command [options] [arguments]

Commands:

init:           Scaffold devenv.yaml, devenv.nix, and .envrc inside the current directory.
init TARGET:    Scaffold devenv.yaml, devenv.nix, and .envrc inside TARGET directory.
search NAME:    Search packages matching NAME in nixpkgs input.
shell:          Activate the developer environment.
shell CMD ARGS: Run CMD with ARGS in the developer environment. Useful when scripting.
update:         Update devenv.lock from devenv.yaml inputs. See http://devenv.sh/inputs/#locking-and-updating-inputs
up:             Starts processes in foreground. See http://devenv.sh/processes
gc:             Removes old devenv generations. See http://devenv.sh/garbage-collection
ci:             builds your developer environment and make sure all checks pass.
version:        Display devenv version

direnv: loading ~/synced/projects/github/dream2nix/.envrc
Building shell ...
warning: applying 'toString' to path 'https://github.com/cachix/devenv/blob/3fe7cbae1d35c4075dac7e0fe58320cfdfa9861e/src/modules/pre-commit.nix' and then accessing it is deprecated, at «stdin»:0
warning: applying 'toString' to path 'https://github.com/cachix/pre-commit-hooks.nix/blob/b6bc0b21e1617e2b07d8205e7fae7224036dfa4b/modules/hooks.nix' and then accessing it is deprecated, at «stdin»:0
warning: applying 'toString' to path 'https://github.com/cachix/pre-commit-hooks.nix/blob/b6bc0b21e1617e2b07d8205e7fae7224036dfa4b/modules/pre-commit.nix' and then accessing it is deprecated, at «stdin»:0
warning: applying 'toString' to path 'https://github.com/cachix/pre-commit-hooks.nix/blob/b6bc0b21e1617e2b07d8205e7fae7224036dfa4b/modules/pre-commit.nix' and then accessing it is deprecated, at «stdin»:0
warning: applying 'toString' to path 'https://github.com/cachix/devenv/blob/3fe7cbae1d35c4075dac7e0fe58320cfdfa9861e/src/modules/pre-commit.nix' and then accessing it is deprecated, at «stdin»:0
error: file 'https://github.com/cachix/pre-commit-hooks.nix/blob/b6bc0b21e1617e2b07d8205e7fae7224036dfa4b/nix/call-tools.nix' does not exist

       … while evaluating the attribute 'value'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:552:44:

          551|       defnsByName' = byName "config" (module: value:
          552|           [{ inherit (module) file; inherit value; }]
             |                                            ^
          553|         ) configs;

       … while evaluating 'dischargeProperties'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:799:25:

          798|   */
          799|   dischargeProperties = def:
             |                         ^
          800|     if def._type or "" == "merge" then

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:728:137:

          727|         defs' = concatMap (m:
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          729|         ) defs;

       … while evaluating definitions from `https://github.com/cachix/devenv/blob/3fe7cbae1d35c4075dac7e0fe58320cfdfa9861e/src/modules/pre-commit.nix':

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:727:28:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                            ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:727:17:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                 ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:840:7:

          839|     in {
          840|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          841|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:741:9:

          740|       in {
          741|         values = defs''';
             |         ^
          742|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'mergedValue'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:747:5:

          746|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          747|     mergedValue =
             |     ^
          748|       if isDefined then

       … while evaluating the option `pre-commit.tools':

       … while evaluating the attribute 'value'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:712:9:

          711|     in warnDeprecation opt //
          712|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          713|         inherit (res.defsFinal') highestPrio;

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:265:72:

          264|           # For definitions that have an associated option
          265|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          266|

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … while evaluating the attribute 'value'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:552:44:

          551|       defnsByName' = byName "config" (module: value:
          552|           [{ inherit (module) file; inherit value; }]
             |                                            ^
          553|         ) configs;

       … while evaluating 'dischargeProperties'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:799:25:

          798|   */
          799|   dischargeProperties = def:
             |                         ^
          800|     if def._type or "" == "merge" then

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:728:137:

          727|         defs' = concatMap (m:
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          729|         ) defs;

       … while evaluating definitions from `https://github.com/cachix/pre-commit-hooks.nix/blob/b6bc0b21e1617e2b07d8205e7fae7224036dfa4b/modules/hooks.nix':

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:727:28:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                            ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:727:17:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                 ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:840:7:

          839|     in {
          840|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          841|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:741:9:

          740|       in {
          741|         values = defs''';
             |         ^
          742|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'mergedValue'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:747:5:

          746|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          747|     mergedValue =
             |     ^
          748|       if isDefined then

       … while evaluating the option `pre-commit.hooks.shellcheck.entry':

       … while evaluating the attribute 'value'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:712:9:

          711|     in warnDeprecation opt //
          712|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          713|         inherit (res.defsFinal') highestPrio;

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:265:72:

          264|           # For definitions that have an associated option
          265|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          266|

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … while evaluating the attribute 'value'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/types.nix:526:60:

          525|           # Push down position info.
          526|           (map (def: mapAttrs (n: v: { inherit (def) file; value = v; }) def.value) defs)));
             |                                                            ^
          527|       emptyValue = { value = {}; };

       … while evaluating 'dischargeProperties'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:799:25:

          798|   */
          799|   dischargeProperties = def:
             |                         ^
          800|     if def._type or "" == "merge" then

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:728:137:

          727|         defs' = concatMap (m:
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          729|         ) defs;

       … while evaluating definitions from `https://github.com/cachix/pre-commit-hooks.nix/blob/b6bc0b21e1617e2b07d8205e7fae7224036dfa4b/modules/pre-commit.nix':

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:727:28:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                            ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:727:17:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                 ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:840:7:

          839|     in {
          840|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          841|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:741:9:

          740|       in {
          741|         values = defs''';
             |         ^
          742|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'optionalValue'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:759:5:

          758|
          759|     optionalValue =
             |     ^
          760|       if isDefined then { value = mergedValue; }

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/types.nix:522:86:

          521|       merge = loc: defs:
          522|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                                                      ^
          523|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/types.nix:522:51:

          521|       merge = loc: defs:
          522|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                   ^
          523|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:225:62:

          224|   filterAttrs = pred: set:
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                              ^
          226|

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:225:29:

          224|   filterAttrs = pred: set:
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                             ^
          226|

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:225:18:

          224|   filterAttrs = pred: set:
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                  ^
          226|

       … while evaluating 'filterAttrs'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:224:23:

          223|   */
          224|   filterAttrs = pred: set:
             |                       ^
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/types.nix:522:35:

          521|       merge = loc: defs:
          522|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                   ^
          523|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while evaluating 'merge'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/types.nix:521:20:

          520|       check = isAttrs;
          521|       merge = loc: defs:
             |                    ^
          522|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:749:59:

          748|       if isDefined then
          749|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          750|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while evaluating the attribute 'mergedValue'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:747:5:

          746|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          747|     mergedValue =
             |     ^
          748|       if isDefined then

       … while evaluating the option `pre-commit.hooks.shellcheck.raw':

       … while evaluating the attribute 'value'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:712:9:

          711|     in warnDeprecation opt //
          712|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          713|         inherit (res.defsFinal') highestPrio;

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:265:72:

          264|           # For definitions that have an associated option
          265|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          266|

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … while evaluating anonymous lambda

       at https://github.com/cachix/pre-commit-hooks.nix/blob/b6bc0b21e1617e2b07d8205e7fae7224036dfa4b/modules/pre-commit.nix:146:25:

          145|   processedHooks =
          146|     mapAttrsToList (id: value: value.raw // { inherit id; }) enabledHooks;
             |                         ^
          147|

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:356:16:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          357|

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:356:10:

          355|   mapAttrsToList = f: attrs:
          356|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          357|

       … while evaluating the attribute 'rawJSON' of the derivation 'pre-commit-config.json'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

       … while evaluating the attribute 'value'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:552:44:

          551|       defnsByName' = byName "config" (module: value:
          552|           [{ inherit (module) file; inherit value; }]
             |                                            ^
          553|         ) configs;

       … while evaluating 'dischargeProperties'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:799:25:

          798|   */
          799|   dischargeProperties = def:
             |                         ^
          800|     if def._type or "" == "merge" then

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:728:137:

          727|         defs' = concatMap (m:
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          729|         ) defs;

       … while evaluating definitions from `https://github.com/cachix/pre-commit-hooks.nix/blob/b6bc0b21e1617e2b07d8205e7fae7224036dfa4b/modules/pre-commit.nix':

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:727:28:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                            ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:727:17:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                 ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:840:7:

          839|     in {
          840|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          841|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:741:9:

          740|       in {
          741|         values = defs''';
             |         ^
          742|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'mergedValue'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:747:5:

          746|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          747|     mergedValue =
             |     ^
          748|       if isDefined then

       … while evaluating the option `pre-commit.installationScript':

       … while evaluating the attribute 'value'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:712:9:

          711|     in warnDeprecation opt //
          712|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          713|         inherit (res.defsFinal') highestPrio;

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:265:72:

          264|           # For definitions that have an associated option
          265|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          266|

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … while evaluating the attribute 'content'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:870:14:

          869|     { _type = "if";
          870|       inherit condition content;
             |              ^
          871|     };

       … while evaluating 'dischargeProperties'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:799:25:

          798|   */
          799|   dischargeProperties = def:
             |                         ^
          800|     if def._type or "" == "merge" then

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:805:11:

          804|         if def.condition then
          805|           dischargeProperties def.content
             |           ^
          806|         else

       … while evaluating 'dischargeProperties'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:799:25:

          798|   */
          799|   dischargeProperties = def:
             |                         ^
          800|     if def._type or "" == "merge" then

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:728:137:

          727|         defs' = concatMap (m:
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          729|         ) defs;

       … while evaluating definitions from `https://github.com/cachix/devenv/blob/3fe7cbae1d35c4075dac7e0fe58320cfdfa9861e/src/modules/pre-commit.nix':

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:727:28:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                            ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:727:17:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                 ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:840:7:

          839|     in {
          840|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          841|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:741:9:

          740|       in {
          741|         values = defs''';
             |         ^
          742|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'mergedValue'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:747:5:

          746|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          747|     mergedValue =
             |     ^
          748|       if isDefined then

       … while evaluating the option `enterShell':

       … while evaluating the attribute 'value'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:712:9:

          711|     in warnDeprecation opt //
          712|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          713|         inherit (res.defsFinal') highestPrio;

       … while evaluating anonymous lambda

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/modules.nix:265:72:

          264|           # For definitions that have an associated option
          265|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          266|

       … from call site

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … while evaluating the attribute 'shellHook' of the derivation 'devenv'

       at https://github.com/NixOS/nixpkgs/blob/3a86856a13c88c8c64ea32082a851fefc79aa700/pkgs/stdenv/generic/make-derivation.nix:270:7:

          269|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          270|       name =
             |       ^
          271|         let

New examples

Please, comment with what kind of an example you'd like to see.

Ensure services are re-usable

The whole devenv with services thing is very promising in general.
We already have services defined in nixpkgs and home-manager which are not re-usable in other contexts.
Without any specification on how services must be defined, it's likely that devenv will end up building yet another walled garden ecosystem of services.

Maybe we could create a specification on writing portable service modules.

One idea, could be to ensure that all services are always created via a submodule.
Submodules cannot access the global context of the module evaluation and therefore provide isolation. With this, it won't be possible for a service to set (ore read from) options of arbitrary other services anymore, which should make it more portable
In the example of postgres, the interface could look like this:

options.postgres = {
  type = types.attrsOf types.submoduleWith {
    modules = [./postgres.nix];
  };
  description = "Create instances of postgres";
  default = {};
};

... which then would be used like this:

config.postgres.pg1.enable = true;
config.postgres.pg2.enable = true;

This also solves the problem of only being able to run one instance at a time.
Of course each service needs to get their own data directory etc. That is something that we could define in the spec.

Just pinging @infinisil @roberth . Maybe you have some useful ideas towards that.

Import devenv from an existing flake.nix

Currently devenv forcefully replaces nix and flakes. For nix native users, or projects that already contain a flake.nix it could be interesting to import devenv as a dependency manually.

I'd like to hear your thoughts about this @domenkozar . Does mixing flake.nix and devenv.nix make sense in general or would it violate devshell in a fundamental way?

Installation via Nix profiles fails

Describe the bug

I am trying to install both cachix and devenv via the flake profiles route. However nix profile install nixpkgs#cachix and nix profile install github:cachix/devenv/v0.3 commands fail for both cachix and devenv with an error message.

Steps To Reproduce

cachix installation:

❯ nix profile install nixpkgs#cachix                                                                                                                                                           master
warning: path '/nix/store/4qdpbi788qb5h78l2rrcnf2lizb9h275-profile' claims to be content-addressed but isn't
error: cannot add path '/nix/store/4qdpbi788qb5h78l2rrcnf2lizb9h275-profile' because it lacks a valid signature

And devenv:

warning: Using saved setting for 'extra-substituters = https://devenv.cachix.org' from ~/.local/share/nix/trusted-settings.json.
warning: Using saved setting for 'extra-trusted-public-keys = devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=' from ~/.local/share/nix/trusted-settings.json.
warning: path '/nix/store/qwkzx221cdg591r7rk7xbl9akz6i1cph-profile' claims to be content-addressed but isn't
error: cannot add path '/nix/store/qwkzx221cdg591r7rk7xbl9akz6i1cph-profile' because it lacks a valid signature

I tried removing ~/.local/share/nix/trusted-settings.json, but the problem persists also without the cached settings.

Expected behavior

Both cachix and devenv should be installed.

Additional context

nix (Nix) 2.11.0 on Ubuntu 22.04.

nix shell github:cachix/devenv/v0.3 works without an error.

As a workaround I now installed both cachix and devenv via the nix-env route, which worked without errors.

yml vs toml

Heya! Very excited about this project 👌

What’s the rationale for choosing yml instead of toml or some other format for the config file?

Direnv is extremely verbose

Disclaimer: this boils down to a direnv and print-dev-env issue, but it still relevant to the UX of devenv.

Running direnv allow after running devenv init, on top of the normal output of devenv, we get something like:

direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +DETERMINISTIC_BUILD +DEVENV_DOTFILE +DEVENV_ROOT +DEVENV_STATE +GREET +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_STORE +NM +OBJCOPY +OBJDUMP +PYTHONHASHSEED +PYTHONNOUSERSITE +PYTHONPATH +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +TMPDIR +_PYTHON_HOST_PLATFORM +_PYTHON_SYSCONFIGDATA_NAME +buildInputs +buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +dontAddDisableDepTrack +mesonFlags +name +nativeBuildInputs +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS

This is very noisy, not very useful, and gives a bad impression.


In the end, this is because nix-shell (and nix develop and nix print-dev-env) is designed to "provide the build environment of a derivation", not making shell environments that don't build a derivation.

devshell fixes that by reimplementing mkShell in a way that removes everything that we don't want (doesn't use mkDerivation, and does additional cleanup): https://github.com/numtide/devshell/blob/master/nix/mkNakedShell.nix.

Referencing an import using ../ ends up in a weird error

Building shell ...
error: Unknown input ..

       … while realising the context of a path

       at .../local/.devenv.flake.nix:27:17:

           26|           devenvpath = input + subpath + "/devenv.nix";
           27|           in if builtins.pathExists devenvpath
             |                 ^
           28|              then devenvpath

I'm not sure this is easy to support, but I'll look into it. At least there should be a good error message.

cc @mads-hartmann

MySQL option

I would like to need an MySQL for my projects. Is it fine to make a PR?

Make nix the only dependency?

Devenv looks very interesting!

But what bugs me a bit is that devenv needs to be installed on the system before it can be used in a project.
That's an additional thing that co-workers have to install first, before they can start working. If they have nix already, it'd be cool if they wouldn't have to install anything first.

Could there be an option to install devenv as well when entering direnv? So that it's locked to a version and it's only available inside the project. Initializing a new project could then probably be done through "nix run github:cachix/devenv init"

direnv: faster loading

Currently, if you use direnv you'll get a note saying it takes too long to export:

image

Is it possible to devenv to perform an export of everything it needs, like the normal nix develop does when used with direnv?

Core Concepts

"Developer Environment" means different things to different people.

A small intro paragraph, and then a bullet with each "concept". That might also be a good place to explain how a "language" is different from a "package".

Also needs a list of files.

Errors when initializing devenv in a non-git directory

pre-commit doesn't like it if the directory is not a git repo.
If .git is required by devenv, it should probably refuse to initialize on directories without it.

grmpf@grmpf-nix ~> nix shell github:cachix/devenv/v0.3
grmpf@grmpf-nix ~> mkdir /tmp/test-devenv && cd /tmp/test-devenv
grmpf@grmpf-nix /t/test-devenv> devenv init
Creating .envrc
Creating devenv.nix
Creating devenv.yaml
Appending .devenv* and devenv.local.nix to .gitignore
Done.
direnv: error /tmp/test-devenv/.envrc is blocked. Run `direnv allow` to approve its content
grmpf@grmpf-nix /t/test-devenv> direnv allow
direnv: loading /tmp/test-devenv/.envrc
Building shell ...
warning: creating lock file '/tmp/test-devenv/devenv.lock'
[0/2 built, 0.3 MiB DL] querying devenv-env on https://nix-community.cachix.orgdirenv: ([/nix/store/a5kmn3sij0dlkxy5xxv7drs08k0qp267-direnv-2.31.0/bin/direnv export fish]) is taking a while to execute. Use CTRL-C to give up.
deadnix 0.1.8
cachix 1.0.1
statix 0.5.6
vulnix 1.10.1
✨ devenv is out of date. Please update to 0.3: https://devenv.sh/getting-started/#installation
pre-commit-hooks.nix: updating /tmp/test-devenv repo
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /home/grmpf/.cache/pre-commit/pre-commit.log
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /home/grmpf/.cache/pre-commit/pre-commit.log
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /home/grmpf/.cache/pre-commit/pre-commit.log
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /home/grmpf/.cache/pre-commit/pre-commit.log
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /home/grmpf/.cache/pre-commit/pre-commit.log
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /home/grmpf/.cache/pre-commit/pre-commit.log
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /home/grmpf/.cache/pre-commit/pre-commit.log
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /home/grmpf/.cache/pre-commit/pre-commit.log
hello from devenv
git version 2.38.1
direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +DETERMINISTIC_BUILD +DEVENV_DOTFILE +DEVENV_ROOT +DEVENV_STATE +GREET +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_STORE +NM +OBJCOPY +OBJDUMP +PYTHONHASHSEED +PYTHONNOUSERSITE +PYTHONPATH +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +TMPDIR +_PYTHON_HOST_PLATFORM +_PYTHON_SYSCONFIGDATA_NAME +buildInputs +buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +dontAddDisableDepTrack +mesonFlags +name +nativeBuildInputs +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS

Run processes in the background

It would be nice to have a way of running processes in the background, similar to docker-compose up -d.

Maybe devenv up -d would be an intuitive choice?

`devenv diff`

Show diff between the last activation and the new one. Diff options and packages.

Package Sets

It would be useful to be able to expose a package set in an environment, so that environments that import it can use a subset.

This would allow us to provide for example a set of all $lang tooling.

Emacs unable to find devenv packages

I am really unsure if this is an issues of emacs or how devenv sets up packages. I am filing a ticket here because this is the first time I have actually had issues with it.

Essentially, I am starting a fresh project and using devenv init in order to start. I then enable languages.elixir, which supports the elixir_ls package. When I direnv allow, I get sent to a dev shell. I can then see that the elixir-ls binary and elixir packages are available. However when I use emacs to start editing the project, it cannot find the elixir-ls binary, and when I manually execute a shell command for elixir --version, I can see I am using my host elixir version instead of the newer version that was supplied by devenv.

I am really unsure of how to debug this kind of thing. But let me know what you need from me and I can do it.

Devenv reports out of date when up to date

Hi,

After installing devenv (using direnv) whenever I enter my folder I get the following message:

Building shell ...
deadnix 0.1.8
cachix 1.0.1
statix 0.5.6
vulnix 1.10.1
✨ devenv is out of date. Please update to 0.3: https://devenv.sh/getting-started/#installation

however when running devenv version I get devenv: 0.3. I'm also using the following input in my flake.nix: devenv.url = "github:cachix/devenv/v0.3";

Here is my NixOS config is more info is needed: https://github.com/jocelynthode/nixos-config

direnv reloading doesn't work

Currently we check if we're in devenv before we activate shell, to prevent a cycle.

This also prevents reloading, so better figure out a better way.

Error when setting `pre-commit.settings.deadnix.fix` to true

When setting: pre-commit.settings.deadnix.fix = true in devenv.nix I get an error everytime I enter my folder (direnv enabled).

direnv: loading ~/Projects/nixos-config/.envrc
Building shell ...
warning: applying 'toString' to path 'https://github.com/cachix/pre-commit-hooks.nix/blob/ebcbfe09d2bd6d15f68de3a0ebb1e4dcb5cd324b/modules/hooks.nix' and then accessing it is deprecated, at «stdin»:0
warning: applying 'toString' to path 'https://github.com/cachix/pre-commit-hooks.nix/blob/ebcbfe09d2bd6d15f68de3a0ebb1e4dcb5cd324b/modules/pre-commit.nix' and then accessing it is deprecated, at «stdin»:0
warning: applying 'toString' to path 'https://github.com/cachix/pre-commit-hooks.nix/blob/ebcbfe09d2bd6d15f68de3a0ebb1e4dcb5cd324b/modules/pre-commit.nix' and then accessing it is deprecated, at «stdin»:0
warning: applying 'toString' to path 'https://github.com/cachix/devenv/blob/59f9436834f819432b5c607238fc336345f19ab0/src/modules/pre-commit.nix' and then accessing it is deprecated, at «stdin»:0
error: attribute 'split' missing

       at https://github.com/cachix/pre-commit-hooks.nix/blob/ebcbfe09d2bd6d15f68de3a0ebb1e4dcb5cd324b/modules/hooks.nix:327:118:

          326|             let
          327|               toArg = string: "--" + (lib.concatMapStringsSep "-" lib.toLower (lib.filter (x: x != "") (lib.flatten (lib.split "([[:upper:]]+[[:lower:]]+)" string))));
             |                                                                                                                      ^
          328|               args = lib.concatMapStringsSep " " toArg (lib.filter (attr: settings.deadnix."${attr}") (lib.attrNames settings.deadnix));

       … while evaluating 'flatten'

       at https://github.com/NixOS/nixpkgs/blob/75f569b1a573c9736501981b1bd1808d30b37d3d/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … from call site

Composing devenv.yaml

Please leave a thumbs up if you'd like to see this happen and a comment with your use case.

Upstream changes needed for flakes

There are a few patches to flakes that should be upstreamed:

  • Relax Nix language restrictions for flakes: this allows us to dynamically compute inputs from yaml files.
  • --flake-file and --flake-lock parameters to override flake.nix and flake.lock: this allows us to dynamically compute flakes and hide it from the users
  • Allow reading files that aren't managed by git: this allows us to dynamically compute flake files so they aren't committed to a repo.
  • Speed up GC
  • abstract source trees, from Eelco's talk at NixCon, this one speeds up flakes by a lot.

Ideas for more languages

Hey !

This project looks good ! I especially like the languages part and how it's (aiming at ?) providing good defaults for creating virtual environments for any language. Back when I was taking classes I had actually started writing a similar module-based shell because popping up an OCaml shell in NixOS was non-trivial. I didn't have time to work on it a lot though so I'm glad that a permanent and actively maintained solution is here !

I'll definitely look into using devenv and contributing to it when I have time, but in the meanwhile I figured you might want to take a look at what I did, especially the OCaml module. Feel free to take inspiration from that :)

`devenv search`

Allow searching for what packages are available from the inputs.

devenv shell exits when any command returns an error

After opening a devenv shell, I typed a command wrong which returned an error to the shell. devenv dropped me out of the nix shell and back to my regular zsh prompt. Typing devenv shell or direnv allow reopens the shell.

Session transcript with minimal reproducible error:

bjk in 🌐 beast in ~/projects/devenvtest on ☁️  (us-east-1) took 1m37s
❯ direnv allow

bjk in 🌐 beast in ~/projects/devenvtest on ☁️  (us-east-1)
❯ direnv allow
direnv: loading ~/projects/devenvtest/.envrc
Building shell ...
Entering shell ...

deadnix 0.1.8
cachix 1.0.1
statix 0.5.6
vulnix 1.10.1
go version go1.19.3 linux/amd64
pre-commit-hooks.nix: hooks up to date
hello from devenv
git version 2.38.1
<< In the devenv shell here>>
(devenv) bjk@beast:~/projects/devenvtest$ false
<< devenv shell has exited here>>
bjk in 🌐 beast in ~/projects/devenvtest on ☁️  (us-east-1) took 4s
❯ devenv --version
https://devenv.sh (version 0.1): Fast, Declarative, Reproducible, and Composable Developer Environments

Versions:
nix (Nix) 2.11.0
direnv 2.32.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.