From 052dea774d4ace4bc9653e25519e264155ec42ae Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sun, 9 Jan 2022 10:24:22 +0100 Subject: feat(users/Profpatsch/nix-home): create gc root on stow Change-Id: Ifda8273502f6f4bef0739005319ee6993cb328c8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4835 Tested-by: BuildkiteCI Reviewed-by: Profpatsch --- users/Profpatsch/nix-home/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/users/Profpatsch/nix-home/default.nix b/users/Profpatsch/nix-home/default.nix index 2b44868f5a19..1369eb5314cc 100644 --- a/users/Profpatsch/nix-home/default.nix +++ b/users/Profpatsch/nix-home/default.nix @@ -5,6 +5,7 @@ let // depot.nix.getBins pkgs.coreutils [ "mkdir" "ln" "printenv" "rm" ] // depot.nix.getBins pkgs.xe [ "xe" ] // depot.nix.getBins pkgs.lr [ "lr" ] + // depot.nix.getBins pkgs.nix [ "nix-store" ] ; # run stow to populate the target directory with the given stow package, read from stowDir. @@ -30,6 +31,14 @@ let ] bins.xe "-0" bins.rm ] + # create an indirect gc root so our config is not cleaned under our asses by a garbage collect + "if" [ + bins.nix-store + "--realise" + "--indirect" + "--add-root" "${stowDirOriginPath}/.nix-stowdir-gc-root" + stowDir + ] # populate with new stow targets "if" [ "elglob" "-w0" "stowPackages" "${stowDir}/*" @@ -85,7 +94,7 @@ lib.pipe {} [ (d: runStow { stowDir = d; stowPackage = "hello"; - targetDir = "/home/philip/tmp"; + targetDir = "/home/philip/tmp/stowed"; stowDirOriginPath = "/home/philip/tmp/stowOrigin"; }) ] -- cgit 1.4.1