nixos/nix-daemon: Enable cgroups delegation (#339310)

When `use-cgroups` is enabled, the nix daemon creates sub-cgroups for the build processes (and itself if NixOS/nix#11412 is merged, see NixOS/nix#9675). `Delegate` should be set to prevent systemd from messing with the nix service's cgroups (https://github.com/systemd/systemd/blob/main/docs/CGROUP_DELEGATION.md) and ensure the OOM killer only targets the offending derivation and not the entire service (NixOS/nix#10374).
This commit is contained in:
Parker Hoyes 2024-09-13 13:08:29 +00:00 committed by GitHub
parent 7f23fcdf9b
commit c960ba48d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -198,6 +198,7 @@ in
IOSchedulingClass = cfg.daemonIOSchedClass;
IOSchedulingPriority = cfg.daemonIOSchedPriority;
LimitNOFILE = 1048576;
Delegate = "yes";
};
restartTriggers = [ config.environment.etc."nix/nix.conf".source ];