Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

nixos/nix-optimise: persist timer

otherwise the timer might never run on laptops which could be shutdown
during the night

+13 -6
+13 -6
nixos/modules/services/misc/nix-optimise.nix
··· 33 } 34 ]; 35 36 - systemd.services.nix-optimise = lib.mkIf config.nix.enable { 37 - description = "Nix Store Optimiser"; 38 - # No point this if the nix daemon (and thus the nix store) is outside 39 - unitConfig.ConditionPathIsReadWrite = "/nix/var/nix/daemon-socket"; 40 - serviceConfig.ExecStart = "${config.nix.package}/bin/nix-store --optimise"; 41 - startAt = lib.optionals cfg.automatic cfg.dates; 42 }; 43 }; 44 }
··· 33 } 34 ]; 35 36 + systemd = lib.mkIf config.nix.enable { 37 + services.nix-optimise = { 38 + description = "Nix Store Optimiser"; 39 + # No point this if the nix daemon (and thus the nix store) is outside 40 + unitConfig.ConditionPathIsReadWrite = "/nix/var/nix/daemon-socket"; 41 + serviceConfig.ExecStart = "${config.nix.package}/bin/nix-store --optimise"; 42 + startAt = lib.optionals cfg.automatic cfg.dates; 43 + }; 44 + 45 + timers.nix-optimise.timerConfig = { 46 + Persistent = true; 47 + RandomizedDelaySec = 1800; 48 + }; 49 }; 50 }; 51 }