about summary refs log tree commit diff
path: root/ops/modules/automatic-gc.nix
diff options
context:
space:
mode:
Diffstat (limited to 'ops/modules/automatic-gc.nix')
-rw-r--r--ops/modules/automatic-gc.nix5
1 files changed, 5 insertions, 0 deletions
diff --git a/ops/modules/automatic-gc.nix b/ops/modules/automatic-gc.nix
index ad53a63f7f16..003f160919f6 100644
--- a/ops/modules/automatic-gc.nix
+++ b/ops/modules/automatic-gc.nix
@@ -13,6 +13,11 @@ let
   gcScript = pkgs.writeShellScript "automatic-nix-gc" ''
     set -ueo pipefail
 
+    if [ -e /run/stop-automatic-gc ]; then
+      echo "GC is disabled through /run/stop-automatic-gc"
+      exit 0
+    fi
+
     readonly MIN_THRESHOLD_KIB="${toString (GiBtoKiB cfg.diskThreshold)}"
     readonly MAX_FREED_BYTES="${toString (GiBtoBytes cfg.maxFreed)}"
     readonly GEN_THRESHOLD="${cfg.preserveGenerations}"