Clean up documentation for tracked files

This commit is contained in:
Bryan Bennett 2022-06-21 09:11:56 -04:00
parent bb63ffabe9
commit b1b717221a
No known key found for this signature in database
GPG key ID: EF90E3E98B8F5C0B
2 changed files with 42 additions and 12 deletions

View file

@ -278,15 +278,45 @@ will be interpeted or passed along.
All single word arguments (`-j4`, `--impure` etc) All single word arguments (`-j4`, `--impure` etc)
are passed to the underlying nix invocation. are passed to the underlying nix invocation.
##### Tracked files #### Tracked files
`nix-direnv` makes a performance tradeoff only considers changes in a limited `nix-direnv` makes a performance tradeoff
number of files when deciding to update its cache. and only considers changes in a limited number of files
when deciding to update its cache.
- for `use nix` this is `~/.direnvrc`, `~/.config/direnv/direnvrc`, `.envrc`, `default.nix` and `shell.nix` - for `use nix` this is:
- for `use flake` this is `~/.direnvrc`, `~/.config/direnv/direnvrc`, `.envrc`, `flake.nix`, `flake.lock` and `devshell.toml` * `~/.direnvrc`
* `~/.config/direnv/direnvrc`
* `.envrc`,
* A single nix file. In order of preference:
+ The file argument to `use nix`
+ `default.nix` if it exists
+ `shell.nix` if it exists
To add more files to be checked use `nix_direnv_watch_file` like this: `nix_direnv_watch_file your-file.nix` - for `use flake` this is:
* `~/.direnvrc`
* `~/.config/direnv/direnvrc`
* `.envrc`
* `flake.nix`
* `flake.lock`
* `devshell.toml` if it exists
To add more files to be checked use `nix_direnv_watch_file` like this
```shell
$ nix_direnv_watch_file your-file.nix
```
Or - if you don't mind the overhead (runtime and conceptual) of watching all nix-files:
```shell
nix_direnv_watch_file $(find . -name "*.nix" -printf '"%p" ')
```
Note that this will re-execute direnv for any nix change,
regardless of whether that change is meaningful for the devShell in use.
`nix_direnv_watch_file` must be invoked before either `use flake` or `use nix` to take effect.
## General direnv tips ## General direnv tips

View file

@ -303,7 +303,7 @@ use_nix() {
done done
# nixfile may be empty, # nixfile may be empty,
# but nix_direnv_watch_file checks for existance before adding to watches # but nix_direnv_watch_file checks for existence before adding to watches
nix_direnv_watch_file "$HOME/.direnvrc" "$HOME/.config/direnv/direnvrc" .envrc "$nixfile" nix_direnv_watch_file "$HOME/.direnvrc" "$HOME/.config/direnv/direnvrc" .envrc "$nixfile"
local need_update=0 local need_update=0