devenv icon indicating copy to clipboard operation
devenv copied to clipboard

direnv: Problems with imported nix file changes

Open vHanda opened this issue 1 year ago • 1 comments

Describe the bug I'm trying to share my devenv.nix configuration across my company, so that more people might be inclined to move towards nix and devenv, instead of having ad-hoc environments.

Since we have many repos, I don't want to create and maintain the devenv files per repo. I'd prefer to do it globally. I've done this by having the devenv.nix/yaml/lock files in a single repo, and asking people to include it in their devenv.nix yaml config.

imports:
  - ./relevant-repo/devenv

I like using devenv with direnv so that one doesn't have to use the 'devenv shell' command.

Via 'devenv shell' everything works great.

Problems -

  • If I change the imported nix files, the other terminals do not automatically rebuild. They do not seem to be watching the file.
  • If I run devenv shell, I get the newly added packages from the imported nix file. However, if I then create a new terminal and enter the project directory and the env is loaded via direnv is not the old one without this package.
  • It's quite a pain, as I'd be happy to run a command to force direnv to use the latest, but I cannot seem to figure out how.
  • Very occasionally when I modify the imported nix files, it does seem to pickup the changes, but very rarely.

What command can I use to force 'direnv' to use the latest devenv files?

Version

devenv 1.0.5 (x86_64-linux) - Not using flakes

vHanda avatar May 24 '24 09:05 vHanda

  1. I would add an input to a shared Github repository instead of a local folder
  2. Once the above is done, you can run devenv update to explictly bump the internal Flake input for the shared config. This also updates the lock file, making the update more explicit.

This is somewhat of a duplicate of https://github.com/cachix/devenv/issues/14

thenonameguy avatar May 24 '24 10:05 thenonameguy

This is solved a long time ago!

domenkozar avatar Apr 25 '25 09:04 domenkozar