cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
3.56k stars 259 forks source link

Get rid of impure mode #658

Closed domenkozar closed 1 month ago

domenkozar commented 11 months ago

https://github.com/NixOS/nix/issues/5663

Atry commented 10 months ago

It is possible to set DEVENV_ROOT to support pure mode See #706, #566 and #583

Atry commented 10 months ago

Why do we need plain Nix expressions as flake inputs? Why not just generate a flake that contains current environment variables, including PWD, then just pass --override-input to use the generated flake.

domenkozar commented 10 months ago

For devenv we can do that, but not for the flakes integration.

Atry commented 10 months ago

How about using --redirect:

nix develop --redirect .#devenv-root .
Atry commented 10 months ago

I think the current impure devenv.root is a dangerous design when packing images via nix2container, because the image content could depend on devenv.root and reference to non-existing directory at runtime.

Atry commented 10 months ago

Ideally, there should be a perWorkingDirectory submodule under devenv, where we can access root. Environment variables that contain abstract paths should be configured under devent.perWorkingDirectory.env, instead of devent.env

domenkozar commented 9 months ago

In #745 we now generate PWD instead of using --impure when using devenv cli.

Atry commented 8 months ago

How about also avoid --impure when using flake? See https://github.com/cachix/devenv/pull/745#discussion_r1285246995

khaled commented 3 months ago

Looking forward to the Python rewrite, as --impure seems to prevent evaluation caching from occurring. This makes devenv annoyingly slow when e.g. entering directories with a use flake --impure in .envrc.

khaled commented 2 months ago

Looking forward to the Python rewrite, as --impure seems to prevent evaluation caching from occurring. This makes devenv annoyingly slow when e.g. entering directories with a use flake --impure in .envrc.

Unless one uses nix-direnv, which caches the nix shell environment. The point about evaluation caching stands though.

Atry commented 1 month ago

Why is this issue closed? --impure is still needed according to https://devenv.sh/guides/using-with-flakes/#getting-started

Atry commented 1 month ago

See https://github.com/cachix/devenv/pull/1018

domenkozar commented 1 month ago

This issue was about devenv itself, for flakes it needs to be fixed in Nix itself. Let's see if #1018 will work :)