mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-11-08 19:46:11 +01:00
Clean up documentation for tracked files
This commit is contained in:
parent
bb63ffabe9
commit
b1b717221a
2 changed files with 42 additions and 12 deletions
42
README.md
42
README.md
|
|
@ -278,15 +278,45 @@ will be interpeted or passed along.
|
|||
All single word arguments (`-j4`, `--impure` etc)
|
||||
are passed to the underlying nix invocation.
|
||||
|
||||
##### Tracked files
|
||||
#### Tracked files
|
||||
|
||||
`nix-direnv` makes a performance tradeoff only considers changes in a limited
|
||||
number of files when deciding to update its cache.
|
||||
`nix-direnv` makes a performance tradeoff
|
||||
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 flake` this is `~/.direnvrc`, `~/.config/direnv/direnvrc`, `.envrc`, `flake.nix`, `flake.lock` and `devshell.toml`
|
||||
- for `use nix` this is:
|
||||
* `~/.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
|
||||
|
||||
|
|
|
|||
2
direnvrc
2
direnvrc
|
|
@ -303,7 +303,7 @@ use_nix() {
|
|||
done
|
||||
|
||||
# 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"
|
||||
|
||||
local need_update=0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue