From f0c28576684dbcfb928e589712442299e062f6ea Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 3 Nov 2024 00:39:23 +0100 Subject: [PATCH] Handle `nix` cache properly --- scripts/lib/nix.fish | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/lib/nix.fish b/scripts/lib/nix.fish index 62e74cbd..28e18ff0 100644 --- a/scripts/lib/nix.fish +++ b/scripts/lib/nix.fish @@ -15,12 +15,15 @@ begin function installNixPkgs -V config -V nixPkgsDir source "$config" - downloadNixPkgs - mkdir -p "$nixPkgsDir" - cp -r "$nixPkgsCache"/* "$nixPkgsDir" + + if [ ! -d "$nixPkgsCache" ] + downloadNixPkgs + mkdir -p "$nixPkgsDir" + cp -r "$nixPkgsCache"/* "$nixPkgsDir" + end end function uninstallNixPkgs -V nixPkgsDir - rm -rf "$nixPkgsDir" + rm -rf (dirname "$nixPkgsDir") end end