use_flake: add gcroot for inputs

This commit is contained in:
Jörg Thalheim 2020-12-25 17:29:44 +01:00
parent 24f58e2ed7
commit e19d62fc02
No known key found for this signature in database
GPG key ID: 003F2096411B5F92
2 changed files with 9 additions and 1 deletions

View file

@ -55,6 +55,7 @@ use_flake() {
watch_file flake.lock
local profile="$(direnv_layout_dir)/flake-profile"
local flake="$(direnv_layout_dir)/flake"
local profile_rc="${profile}.rc"
if [[ ! -e "$profile"
@ -72,6 +73,11 @@ use_flake() {
echo "$tmp_profile_rc" > "$profile_rc"
rm -f "$tmp_profile" "$tmp_profile"*
_nix_add_gcroot "$drv" "$profile"
# also add garbage collection root for source
local flake_source=$(nix eval --impure --raw --expr 'builtins.getFlake (toString ./.)')
_nix_add_gcroot "$flake_source" "$flake"
log_status renewed cache
else
log_status using cached dev shell