nixos/nix-{gc,optimise}: do not start when switching (#415324)

This commit is contained in:
Sandro
2025-07-01 11:59:50 +02:00
committed by GitHub
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -88,6 +88,8 @@ in
script = "exec ${config.nix.package.out}/bin/nix-collect-garbage ${cfg.options}";
serviceConfig.Type = "oneshot";
startAt = lib.optionals cfg.automatic cfg.dates;
# do not start and delay when switching
restartIfChanged = false;
};
systemd.timers.nix-gc = lib.mkIf cfg.automatic {
@@ -69,6 +69,8 @@ in
unitConfig.ConditionPathIsReadWrite = "/nix/var/nix/daemon-socket";
serviceConfig.ExecStart = "${config.nix.package}/bin/nix-store --optimise";
startAt = lib.optionals cfg.automatic cfg.dates;
# do not start and delay when switching
restartIfChanged = false;
};
timers.nix-optimise = lib.mkIf cfg.automatic {