Unverified Commit 1e329c89 authored by Ramses's avatar Ramses Committed by GitHub
Browse files

nixos/nix-optimise: run with lower priority (#420721)

parents c77302b0 9ff95589
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -65,9 +65,17 @@ in
    systemd = lib.mkIf config.nix.enable {
      services.nix-optimise = {
        description = "Nix Store Optimiser";
        unitConfig = {
          ConditionACPower = true;
          # No point this if the nix daemon (and thus the nix store) is outside
        unitConfig.ConditionPathIsReadWrite = "/nix/var/nix/daemon-socket";
        serviceConfig.ExecStart = "${config.nix.package}/bin/nix-store --optimise";
          ConditionPathIsReadWrite = "/nix/var/nix/daemon-socket";
        };
        serviceConfig = {
          ExecStart = "${lib.getExe' config.nix.package "nix-store"} --optimise";
          Nice = 19;
          CPUSchedulingPolicy = "idle";
          IOSchedulingClass = "idle";
        };
        startAt = lib.optionals cfg.automatic cfg.dates;
        # do not start and delay when switching
        restartIfChanged = false;