OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
HASH      2bcaca6e2b34
DATE      2026-07-18
SUBJECT   nix: publish by rename with prune-first, builds never run during activation
FILES     1 CHANGED
HASH      2bcaca6e2b34
DATE      2026-07-18
SUBJECT   nix: publish by rename with
          prune-first, builds never run during
          activation
FILES     1 CHANGED
 

diff --git a/nix/module.nix b/nix/module.nix
index f63189a..42b80d7 100644
--- a/nix/module.nix
+++ b/nix/module.nix
@@ -74,15 +74,17 @@
       npm ci --no-audit --no-fund
       OOKNET_GIT_ROOT="$state/mirrors" npm run build
 
-      # publish: timestamped dir, atomic symlink swap, prune old builds
+      # publish: prune first so the disk never holds an extra copy,
+      # then MOVE dist into place (same filesystem - a rename, not a
+      # copy), and swap the symlink
       ts=$(date +%Y%m%d-%H%M%S)
       mkdir -p "$state/builds"
-      cp -r dist "$state/builds/$ts"
+      find "$state/builds" -mindepth 1 -maxdepth 1 -type d \
+        | sort | head -n -${toString (cfg.keepBuilds - 1)} | xargs -r rm -rf
+      mv dist "$state/builds/$ts"
       chmod -R a+rX "$state/builds/$ts"
       ln -sfn "builds/$ts" "$state/current.tmp"
       mv -T "$state/current.tmp" "$state/current"
-      find "$state/builds" -mindepth 1 -maxdepth 1 -type d \
-        | sort | head -n -${toString cfg.keepBuilds} | xargs -r rm -rf
     '';
   };
 
@@ -196,8 +198,8 @@ in {
 
     keepBuilds = mkOption {
       type = types.ints.positive;
-      default = 3;
-      description = "Previous builds retained for rollback.";
+      default = 2;
+      description = "Builds retained including the live one - 2 keeps one rollbac
k. Multi-gigabyte outputs on small disks want this low.";
     };
 
     user = mkOption {
@@ -229,6 +231,9 @@ in {
 
     systemd.services.ooknet-site-build = {
       description = "ooknet.org site build";
+      # webhook/timer-driven oneshot: activation must not run builds or
+      # inherit their failures
+      restartIfChanged = false;
       serviceConfig = {
         Type = "oneshot";
         User = cfg.user;

diff --git a/nix/module.nix b/nix/module.nix
index f63189a..42b80d7 100644
--- a/nix/module.nix
+++ b/nix/module.nix
@@ -74,15 +74,17 @@
       npm ci --no-audit --no-fund
       OOKNET_GIT_ROOT="$state/mirrors" npm 
run build
 
-      # publish: timestamped dir, atomic sy
mlink swap, prune old builds
+      # publish: prune first so the disk ne
ver holds an extra copy,
+      # then MOVE dist into place (same fil
esystem - a rename, not a
+      # copy), and swap the symlink
       ts=$(date +%Y%m%d-%H%M%S)
       mkdir -p "$state/builds"
-      cp -r dist "$state/builds/$ts"
+      find "$state/builds" -mindepth 1 -max
depth 1 -type d \
+        | sort | head -n -${toString (cfg.k
eepBuilds - 1)} | xargs -r rm -rf
+      mv dist "$state/builds/$ts"
       chmod -R a+rX "$state/builds/$ts"
       ln -sfn "builds/$ts" "$state/current.
tmp"
       mv -T "$state/current.tmp" "$state/cu
rrent"
-      find "$state/builds" -mindepth 1 -max
depth 1 -type d \
-        | sort | head -n -${toString cfg.ke
epBuilds} | xargs -r rm -rf
     '';
   };
 
@@ -196,8 +198,8 @@ in {
 
     keepBuilds = mkOption {
       type = types.ints.positive;
-      default = 3;
-      description = "Previous builds retain
ed for rollback.";
+      default = 2;
+      description = "Builds retained includ
ing the live one - 2 keeps one rollback. Mul
ti-gigabyte outputs on small disks want this
 low.";
     };
 
     user = mkOption {
@@ -229,6 +231,9 @@ in {
 
     systemd.services.ooknet-site-build = {
       description = "ooknet.org site build"
;
+      # webhook/timer-driven oneshot: activ
ation must not run builds or
+      # inherit their failures
+      restartIfChanged = false;
       serviceConfig = {
         Type = "oneshot";
         User = cfg.user;
 
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET