summary refs log tree commit diff
path: root/nixos/modules/system/boot/systemd.nix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-11-17 21:54:26 +0100
committerFlorian Klink <flokli@flokli.de>2020-11-19 16:56:46 +0100
commitd22b3ed4bcd24dcc96fd9f99c75bb568bffe2a8c (patch)
tree4019622d6149592c7c771ff05996b84386ce12ea /nixos/modules/system/boot/systemd.nix
parente949d758998fafbef608adcf9f54d79a6e7da4c8 (diff)
downloadnixpkgs-d22b3ed4bcd24dcc96fd9f99c75bb568bffe2a8c.tar
nixpkgs-d22b3ed4bcd24dcc96fd9f99c75bb568bffe2a8c.tar.gz
nixpkgs-d22b3ed4bcd24dcc96fd9f99c75bb568bffe2a8c.tar.bz2
nixpkgs-d22b3ed4bcd24dcc96fd9f99c75bb568bffe2a8c.tar.lz
nixpkgs-d22b3ed4bcd24dcc96fd9f99c75bb568bffe2a8c.tar.xz
nixpkgs-d22b3ed4bcd24dcc96fd9f99c75bb568bffe2a8c.tar.zst
nixpkgs-d22b3ed4bcd24dcc96fd9f99c75bb568bffe2a8c.zip
systemd: switch to unified cgroup hierarchy by default
See https://www.redhat.com/sysadmin/fedora-31-control-group-v2 for
details on why this is desirable, and how it impacts containers.

Users that need to keep using the old cgroup hierarchy can re-enable it
by setting `systemd.unifiedCgroupHierarchy` to `false`.

Well-known candidates not supporting that hierarchy, like docker and
hidepid=… will disable it automatically.

Fixes #73800
Diffstat (limited to 'nixos/modules/system/boot/systemd.nix')
-rw-r--r--nixos/modules/system/boot/systemd.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index c22264b3e92..cbf9e7b49d3 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -550,6 +550,14 @@ in
       '';
     };
 
+    systemd.enableUnifiedCgroupHierarchy = mkOption {
+      default = true;
+      type = types.bool;
+      description = ''
+        Whether to enable the unified cgroup hierarchy (cgroupsv2).
+      '';
+    };
+
     systemd.coredump.enable = mkOption {
       default = true;
       type = types.bool;
@@ -1178,6 +1186,7 @@ in
     boot.kernel.sysctl = mkIf (!cfg.coredump.enable) {
       "kernel.core_pattern" = "core";
     };
+    boot.kernelParams = optional (!cfg.enableUnifiedCgroupHierarchy) "systemd.unified_cgroup_hierarchy=0";
   };
 
   # FIXME: Remove these eventually.