-
-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow watching of arbitrary files for nix flake updates #148
Allow watching of arbitrary files for nix flake updates #148
Conversation
cc @bbenne10 |
@Mic92: I suppose the question is whether we want a difference between invalidation of nix cache independent of the direnv cache. This would work fine for my use case and is a lot simpler than the PR I've opened since my approach uses functions rather than a variable. Simplicity, clarity, and aligning the nix cache and the direnv cache are all good things and so I am all for this approach over the one taken in #145. The only trouble that I see with this is that it doesn't seem to touch (As an aside: What do we think of maybe overriding |
eee1d8f
to
3f5b5cc
Compare
@bbenne10: Thanks for the feedback. Sorry, I guess we solved a similar problem at the same time. I haven't seen your PR before opening this one. In any case, If needed, I think the function approach would still be compatible with this. We could call this custom function if it exists, and then set Indeed, I was going for a minimum viable version to show at first. I've added support for |
No need to be sorry for solving the same problem but better. I believe that your use-case is the same as mine overall and that overriding I'm hoping to get feedback from @dvzubarev on one or both of these PRs soon, but I understand that life happens and we may need to move forward without that. I may suggest also updating the README to describe the functionality |
Thinking on it - if we're overriding |
5473036
to
9f84b5a
Compare
Function is called |
I think that some documentation is in order for this, but otherwise I'm happy to sign off on it. |
36d8f36
to
9ccda52
Compare
I've replaced the |
Lgtm |
Used to watch files that, when changed, trigger an update of the cached nix environment.
9ccda52
to
1241f11
Compare
Thanks! |
* Update hashes * Hash obtained via: ```sh direnv fetchurl "https://raw.githubusercontent.com/nix-community/nix-direnv/master/direnvrc" \ | grep -m1 -o 'sha256-.*' ``` * Bump tag to 1.6.1 in: * README.md * direnvrc * template/.envrc This release includes the following changes: * Allow watching of arbitrary files for nix flake updates ([nix-community#148][1]) [1]: nix-community#148
* Update hashes * Hash obtained via: ```sh direnv fetchurl 'https://raw.githubusercontent.com/nix-community/nix-direnv/master/direnvrc' \ | grep -m1 -o 'sha256-.*' ``` * Bump tag to 1.6.1 in: * README.md * direnvrc * template/.envrc This release includes the following changes: * Allow watching of arbitrary files for nix flake updates ([nix-community#148][1]) [1]: nix-community#148
For more complex flake projects that branch out into other nix-files, it is currently not possible to trigger a rebuild of the environment when one of these files changes. Even if they are added to the
direnv
watches usingwatch_file
,use_flake
will check only some pre-determined files and otherwise will re-use the cached environment resulting in an out-of-sync environment.This is a first suggestion on how an approach to watching multiple files might look and will likely require some re-work. Essentially, instead of using
watch_file <file>
, you now writenix_watches+=(<file1> <file2>)
. The functionality was changed such that all the files in that array are now checked and whenever one of them changed, it will correctly trigger rebuilding the environment.This would also properly fix #51