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.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/ops/modules/automatic-gc.nix b/ops/modules/automatic-gc.nix
index 6347857210..003f160919 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}"
@@ -29,7 +34,8 @@ let
       echo "Skipping GC, enough space available"
     fi
   '';
-in {
+in
+{
   options.services.depot.automatic-gc = {
     enable = lib.mkEnableOption description;