From 0182aa1fa52a60e584bce9718c108645d84d9c13 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