@@ -524,6 +524,14 @@ in
524524 '';
525525 };
526526
527+ systemd.enableCgroupAccounting = mkOption {
528+ default = false;
529+ type = types.bool;
530+ description = ''
531+ Whether to enable cgroup accounting.
532+ '';
533+ };
534+
527535 systemd.extraConfig = mkOption {
528536 default = "";
529537 type = types.lines;
@@ -725,6 +733,13 @@ in
725733
726734 "systemd/system.conf".text = ''
727735 [Manager]
736+ ${optionalString config.systemd.enableCgroupAccounting ''
737+ DefaultCPUAccounting=yes
738+ DefaultIOAccounting=yes
739+ DefaultBlockIOAccounting=yes
740+ DefaultMemoryAccounting=yes
741+ DefaultTasksAccounting=yes
742+ ''}
728743 ${config.systemd.extraConfig}
729744 '';
730745