Fixes for PR review:

- 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
This commit is contained in:
Andreas Pelme 2023-06-16 21:38:16 +02:00 committed by Mic92
parent 1df80c4c3a
commit 6b5822b75b
2 changed files with 86 additions and 42 deletions

View file

@ -291,6 +291,26 @@ This leads to some limitations in what we can reasonably parse.
Currently, all single-word arguments and some well-known double arguments
will be interpeted or passed along.
#### Manual reload of the nix environment
To avoid delays and time consuming rebuilds at unexpected times, you can use
nix-direnv in the "manual reload" mode. nix-direnv will then tell you when the
nix environment is no longer up to date. You can then decide yourself when you
want to reload the nix environment.
To activate manual mode, use `nix_direnv_manual_reload` in your `.envrc` like this:
```shell
nix_direnv_manual_reload
use nix # or use flake
```
To reload your nix environment, use the `nix-direnv-reload` command:
```console
$ nix-direnv-reload
```
##### Known arguments
- `-p`: Starts a list of packages to install; consumes all remaining arguments