Skip to content

Commit

Permalink
nixos/nix-daemon: Enable cgroups delegation (#339310)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
parkerhoyes committed Sep 13, 2024
1 parent 7f23fcd commit c960ba4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions nixos/modules/services/system/nix-daemon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ in
IOSchedulingClass = cfg.daemonIOSchedClass;
IOSchedulingPriority = cfg.daemonIOSchedPriority;
LimitNOFILE = 1048576;
Delegate = "yes";
};

restartTriggers = [ config.environment.etc."nix/nix.conf".source ];
Expand Down

0 comments on commit c960ba4

Please sign in to comment.