-
-
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 manual reload of nix environment. #359
Conversation
As for improved UX, what about creating a script at
To refresh the cache, the command would then be:
|
I have implemented this idea and updated the PR. |
I like the idea, but I think |
You cannot have shell functions because direnv only exports environment variables back into the shell. This is because direnv wants to support non-posix shells like fish. |
This fixes #292 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the changes I've asked for, I'd be happy to merge this.
Note that you'll also need to address the shellcheck failures before merge. |
Thanks a lot for your feedback and I am glad you find it useful. Bash scripting is not my primary cup of tea and I appreciate the improvements you have suggested. Will go through all comments and update the PR! Will also make sure use_nix works too, I did only focus on use_flake to start of with. |
I have updated the PR with these changes:
|
052c662
to
b772628
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm. Since @Mic92 also requested changes, I'll wait till he approves as well to merge.
@mergify queue |
🛑 The pull request has been removed from the queue
|
@Mergifyio refresh |
✅ Pull request refreshed |
@Mergifyio rebase |
Adding nix_direnv_manual_refresh to .envrc will avoid the automatic update of the nix environment on changes and allow the user to issue a command to update the nix environment explicitly. Sometimes it takes a long time to rebuild the nix environment and it happens in times. Switching branches in or rebasing can be painful since nix will re-evaluate between nix file changes. This blog post explains the problems with blocking the shell: https://dev.to/allenap/some-direnv-best-practices-actually-just-one-4864 This is a first prototype, the UX can certainly be improved a bit.
- Always create the nix-direnv-reload script - Use 0/1 for booleans - Avoid crashing when profile_rc does not exist - Use better internal variable name for manual mode - Make use_nix work - Avoid unneccessary forks - Fix shellcheck failures - Update mtime on profile rc files to avoid confusion about if the files are up to date - Add instructions to README.md
✅ Branch has been successfully rebased |
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 3f9e573 |
Adding nix_direnv_manual_reload to .envrc will avoid the automatic update of the nix environment on changes and allow the user to issue a command to update the nix environment explicitly.
Sometimes it takes a long time to rebuild the nix environment and it happens in times. Switching branches in or rebasing can be painful since nix will re-evaluate between nix file changes.
This blog post explains the problems with blocking the shell: https://dev.to/allenap/some-direnv-best-practices-actually-just-one-4864
Example usage:
What do you think about this?