about summary refs log tree commit diff
path: root/users/Profpatsch
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2022-01-09T09·24+0100
committerProfpatsch <mail@profpatsch.de>2022-01-09T09·32+0000
commit052dea774d4ace4bc9653e25519e264155ec42ae (patch)
tree614752547bbef1458c0b1f3125ccee27696487e2 /users/Profpatsch
parentfed41f49597d5f8e0501fa494b314e3fa04d0883 (diff)
feat(users/Profpatsch/nix-home): create gc root on stow r/3578
Change-Id: Ifda8273502f6f4bef0739005319ee6993cb328c8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4835
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch')
-rw-r--r--users/Profpatsch/nix-home/default.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/users/Profpatsch/nix-home/default.nix b/users/Profpatsch/nix-home/default.nix
index 2b44868f5a..1369eb5314 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";
   })
 ]