mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-11-08 19:46:11 +01:00
Watch nixfile in use_nix
This allows us to track the entry point the user specified or whatever entry point we fallback to via auto-selection. This should suprise fewer users. Closes #197
This commit is contained in:
parent
bd76e52a97
commit
ba0cbc1c07
1 changed files with 10 additions and 10 deletions
20
direnvrc
20
direnvrc
|
|
@ -249,7 +249,14 @@ use_nix() {
|
|||
local attribute=
|
||||
local packages=""
|
||||
local extra_args=()
|
||||
|
||||
local nixfile=
|
||||
if [[ -e "shell.nix" ]]; then
|
||||
nixfile="./shell.nix"
|
||||
elif [[ -e "default.nix" ]]; then
|
||||
nixfile="./default.nix"
|
||||
fi
|
||||
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
i="$1"
|
||||
shift
|
||||
|
|
@ -295,7 +302,9 @@ use_nix() {
|
|||
esac
|
||||
done
|
||||
|
||||
nix_direnv_watch_file "$HOME/.direnvrc" "$HOME/.config/direnv/direnvrc" .envrc default.nix shell.nix
|
||||
# nixfile may be empty,
|
||||
# but nix_direnv_watch_file checks for existance before adding to watches
|
||||
nix_direnv_watch_file "$HOME/.direnvrc" "$HOME/.config/direnv/direnvrc" .envrc "$nixfile"
|
||||
|
||||
local need_update=0
|
||||
local file=
|
||||
|
|
@ -317,15 +326,6 @@ use_nix() {
|
|||
if [[ "$packages" != "" ]]; then
|
||||
extra_args+=("--expr" "with import <nixpkgs> {}; mkShell { buildInputs = [ $packages ]; }")
|
||||
else
|
||||
# figure out what file we should use
|
||||
if [[ "$nixfile" == "" ]]; then
|
||||
if [[ -e "shell.nix" ]]; then
|
||||
nixfile="./shell.nix"
|
||||
elif [[ -e "default.nix" ]]; then
|
||||
nixfile="./default.nix"
|
||||
fi
|
||||
fi
|
||||
|
||||
# figure out what attribute we should build
|
||||
if [[ "$attribute" == "" ]]; then
|
||||
extra_args+=("--file" "$nixfile")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue