Git Product home page Git Product logo

devenv's Introduction

Test Hackage

Cachix - Nix binary cache hosting: Never build software twice.

$ cachix --help
https://cachix.org command line interface

Usage: cachix [--hostname URI] [-c|--config CONFIGPATH] [-v|--verbose]
              (-V|--version)

  To get started log in to https://app.cachix.org

Available options:
  -h,--help                Show this help text
  --hostname URI           Host to connect to (default: https://cachix.org)
  -c,--config CONFIGPATH   Cachix configuration file
                           (default: "/home/domen/.config/cachix/cachix.dhall")
  -v,--verbose             Verbose mode
  -V,--version             Show cachix version

Available commands:
  authtoken                Configure an authentication token for Cachix
  config                   Manage configuration settings for cachix
  daemon                   Run a daemon that listens to push requests over a
                           unix socket
  generate-keypair         Generate a signing key pair for a binary cache
  push                     Upload Nix store paths to a binary cache
  import                   Import the contents of a binary cache from an
                           S3-compatible object storage service into Cachix,
                           e.g. s3://localhost:9000/mybucket
  pin                      Pin a store path to prevent it from being garbage
                           collected
  watch-exec               Run a command while watching /nix/store for newly
                           added store paths and upload them to a binary cache
  watch-store              Watch /nix/store for newly added store paths and
                           upload them to a binary cache
  use                      Configure a binary cache in nix.conf
  remove                   Remove a binary cache from nix.conf
  deploy                   Manage remote Nix-based systems with Cachix Deploy

Installation

  1. Install the Cachix client using Nix:
nix-env -iA cachix -f https://cachix.org/api/v1/install

Also available as pkgs.cachix in nixpkgs.

  1. Login via https://www.cachix.org/api/v1/login to start using the service

Development

Install Cachix from master:

nix-env -if https://github.com/cachix/cachix/tarball/master --substituters 'https://cache.nixos.org https://cachix.cachix.org' --trusted-public-keys 'cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY='

Or with Nix 2.4+:

nix profile install github:cachix/cachix/latest --accept-flake-config

Support

Changelog

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 jochenmanz avatar kwbauson avatar matthiasdebernardini avatar mcdonc avatar mmlb 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  avatar  avatar

devenv's Issues

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.

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"

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.

`devenv search`

Allow searching for what packages are available from the inputs.

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.

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

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

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.

New examples

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

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.

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

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.

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

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 :)

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?

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.

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?

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

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

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

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?

`devenv diff`

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

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.

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

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.

MySQL option

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

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?

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

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.