From 451c7160c8166f8ef235b973af799f7c3537ac09 Mon Sep 17 00:00:00 2001 From: chn Date: Sat, 10 Jun 2023 03:21:34 +0800 Subject: [PATCH] make nix daemon low priority --- modules/basic.nix | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/modules/basic.nix b/modules/basic.nix index d0b55c8d..b4a1949d 100644 --- a/modules/basic.nix +++ b/modules/basic.nix @@ -3,17 +3,31 @@ config = { nixpkgs.hostPlatform = "x86_64-linux"; - nix.settings = + nix = { - experimental-features = [ "nix-command" "flakes" ]; - keep-outputs = true; - system-features = [ "big-parallel" ]; - keep-failed = true; + settings = + { + experimental-features = [ "nix-command" "flakes" ]; + keep-outputs = true; + system-features = [ "big-parallel" ]; + keep-failed = true; + }; + daemonIOSchedClass = "idle"; + daemonCPUSchedPolicy = "idle"; }; networking.hostName = hostName; time.timeZone = "Asia/Shanghai"; system.stateVersion = "22.11"; nixpkgs.config.allowUnfree = true; - systemd = { extraConfig = "DefaultTimeoutStopSec=10s"; user.extraConfig = "DefaultTimeoutStopSec=10s"; }; + systemd = + { + extraConfig = "DefaultTimeoutStopSec=10s"; + user.extraConfig = "DefaultTimeoutStopSec=10s"; + } // + ( + if inputs.config.services.xserver.enable then + { services.nix-daemon.serviceConfig.Slice = "user.slice"; } + else {} + ); }; }