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

authored by Sandro and committed by GitHub 0d03b87d ace047b8

+4
+2
nixos/modules/services/misc/nix-gc.nix
··· 88 88 script = "exec ${config.nix.package.out}/bin/nix-collect-garbage ${cfg.options}"; 89 89 serviceConfig.Type = "oneshot"; 90 90 startAt = lib.optionals cfg.automatic cfg.dates; 91 + # do not start and delay when switching 92 + restartIfChanged = false; 91 93 }; 92 94 93 95 systemd.timers.nix-gc = lib.mkIf cfg.automatic {
+2
nixos/modules/services/misc/nix-optimise.nix
··· 69 69 unitConfig.ConditionPathIsReadWrite = "/nix/var/nix/daemon-socket"; 70 70 serviceConfig.ExecStart = "${config.nix.package}/bin/nix-store --optimise"; 71 71 startAt = lib.optionals cfg.automatic cfg.dates; 72 + # do not start and delay when switching 73 + restartIfChanged = false; 72 74 }; 73 75 74 76 timers.nix-optimise = lib.mkIf cfg.automatic {