mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-11-18 16:29:44 +01:00
make condition checks more eye-pleasing
This commit is contained in:
parent
83eb30fbdd
commit
970c00c66c
1 changed files with 13 additions and 11 deletions
24
direnvrc
24
direnvrc
|
|
@ -55,12 +55,13 @@ use_flake() {
|
||||||
local profile="$(direnv_layout_dir)/flake-profile"
|
local profile="$(direnv_layout_dir)/flake-profile"
|
||||||
local profile_rc="${profile}.rc"
|
local profile_rc="${profile}.rc"
|
||||||
|
|
||||||
if [[ ! -e "$profile" ]] || \
|
if [[ ! -e "$profile" \
|
||||||
[[ ! -e "$profile_rc" ]] || \
|
|| ! -e "$profile_rc" \
|
||||||
[[ "$HOME/.direnvrc" -nt "$profile_rc" ]] || \
|
|| "$HOME/.direnvrc" -nt "$profile_rc"
|
||||||
[[ .envrc -nt "$profile_rc" ]] || \
|
|| .envrc -nt "$profile_rc"
|
||||||
[[ flake.nix -nt "$profile_rc" ]] || \
|
|| flake.nix -nt "$profile_rc"
|
||||||
[[ flake.lock -nt "$profile_rc" ]];
|
|| flake.lock -nt "$profile_rc"
|
||||||
|
]];
|
||||||
then
|
then
|
||||||
local tmp_profile="$(direnv_layout_dir)/flake-profile.$$"
|
local tmp_profile="$(direnv_layout_dir)/flake-profile.$$"
|
||||||
[[ -d "$(direnv_layout_dir)" ]] || mkdir "$(direnv_layout_dir)"
|
[[ -d "$(direnv_layout_dir)" ]] || mkdir "$(direnv_layout_dir)"
|
||||||
|
|
@ -120,11 +121,12 @@ use_nix() {
|
||||||
local cache="$direnv_dir/cache-${version:-unknown}"
|
local cache="$direnv_dir/cache-${version:-unknown}"
|
||||||
|
|
||||||
local update_drv=0
|
local update_drv=0
|
||||||
if [[ ! -e "$cache" ]] || \
|
if [[ ! -e "$cache" \
|
||||||
[[ "$HOME/.direnvrc" -nt "$cache" ]] || \
|
|| "$HOME/.direnvrc" -nt "$cache" \
|
||||||
[[ .envrc -nt "$cache" ]] || \
|
|| .envrc -nt "$cache" \
|
||||||
[[ default.nix -nt "$cache" ]] || \
|
|| default.nix -nt "$cache" \
|
||||||
[[ shell.nix -nt "$cache" ]];
|
|| shell.nix -nt "$cache" \
|
||||||
|
]];
|
||||||
then
|
then
|
||||||
[[ -d "$direnv_dir" ]] || mkdir "$direnv_dir"
|
[[ -d "$direnv_dir" ]] || mkdir "$direnv_dir"
|
||||||
local dump_cmd tmp
|
local dump_cmd tmp
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue