mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-12-05 16:41:11 +01:00
Merge 070325a126 into 503cdf3a10
This commit is contained in:
commit
77a34a81ed
1 changed files with 11 additions and 0 deletions
11
direnvrc
11
direnvrc
|
|
@ -189,6 +189,15 @@ _nix_add_gcroot() {
|
||||||
_nix build --out-link "$symlink" "$storepath"
|
_nix build --out-link "$symlink" "$storepath"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_nix_refresh_gcroots() {
|
||||||
|
# Use touch to update all symlinks' timestamps to prevent nh
|
||||||
|
# from garbage collecting the frequently used direnv environment.
|
||||||
|
local layout_dir
|
||||||
|
layout_dir=$(direnv_layout_dir)
|
||||||
|
|
||||||
|
touch -h "${layout_dir}"/flake-profile-* "${layout_dir}"/flake-inputs/* "${layout_dir}"/nix-profile-*
|
||||||
|
}
|
||||||
|
|
||||||
_nix_clean_old_gcroots() {
|
_nix_clean_old_gcroots() {
|
||||||
local layout_dir=$1
|
local layout_dir=$1
|
||||||
|
|
||||||
|
|
@ -371,6 +380,7 @@ use_flake() {
|
||||||
if [[ -e ${profile_rc} ]]; then
|
if [[ -e ${profile_rc} ]]; then
|
||||||
# Our cache is valid, use that
|
# Our cache is valid, use that
|
||||||
_nix_direnv_info "Using cached dev shell"
|
_nix_direnv_info "Using cached dev shell"
|
||||||
|
_nix_refresh_gcroots
|
||||||
else
|
else
|
||||||
# We don't have a profile_rc to use!
|
# We don't have a profile_rc to use!
|
||||||
_nix_direnv_error "use_flake failed - Is your flake's devShell working?"
|
_nix_direnv_error "use_flake failed - Is your flake's devShell working?"
|
||||||
|
|
@ -549,6 +559,7 @@ use_nix() {
|
||||||
else
|
else
|
||||||
if [[ -e ${profile_rc} ]]; then
|
if [[ -e ${profile_rc} ]]; then
|
||||||
_nix_direnv_info "Using cached dev shell"
|
_nix_direnv_info "Using cached dev shell"
|
||||||
|
_nix_refresh_gcroots
|
||||||
else
|
else
|
||||||
_nix_direnv_error "use_nix failed - Is your nix shell working?"
|
_nix_direnv_error "use_nix failed - Is your nix shell working?"
|
||||||
unset IN_NIX_SHELL
|
unset IN_NIX_SHELL
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue