cachix / devenv

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

Streamline .envrc used in templates #1134

Open dliberalesso opened 2 weeks ago

dliberalesso commented 2 weeks ago

As per nix-direnv's Readme, there is no need to explicitly watch flake.nix or flake.lock beacause it already does that.

Also, nix_direnv_watch_file has been deprecated.

domenkozar commented 2 weeks ago

Doesn't this switch away from nix-direnv?

dliberalesso commented 2 weeks ago

It depends on the user environment, right?

The first thing to pay attention to, is that the following code enforces version 2.2.1 even if the user has a newer version of nix-direnv.

if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
  source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi

Which means we should be updating these files everytime a new release of nix-direnv comes around. Why should we have to do that? (They are on version 3.0.4, btw).

The other thing is: the user needs to have nix and direnv already installed for this to work. Why not let the user manage their prefered nix-direnv too?