diff --git a/modules/systemd.nix b/modules/systemd.nix index ff70edf8..7a27e95b 100644 --- a/modules/systemd.nix +++ b/modules/systemd.nix @@ -125,9 +125,9 @@ in { slices = mkOption { default = { }; - type = unitType "slices"; - description = unitDescription "slices"; - example = unitExample "Slices"; + type = unitType "slice"; + description = unitDescription "slice"; + example = unitExample "Slice"; }; sockets = mkOption { @@ -263,7 +263,7 @@ in { (mkIf (pkgs.stdenv.isLinux && config.home.username != "root") { xdg.configFile = mkMerge [ (lib.listToAttrs ((buildServices "service" cfg.services) - ++ (buildServices "slices" cfg.slices) + ++ (buildServices "slice" cfg.slices) ++ (buildServices "socket" cfg.sockets) ++ (buildServices "target" cfg.targets) ++ (buildServices "timer" cfg.timers) diff --git a/tests/modules/systemd/default.nix b/tests/modules/systemd/default.nix index c949edd9..a0271b47 100644 --- a/tests/modules/systemd/default.nix +++ b/tests/modules/systemd/default.nix @@ -2,5 +2,6 @@ systemd-services = ./services.nix; systemd-services-disabled-for-root = ./services-disabled-for-root.nix; systemd-session-variables = ./session-variables.nix; + systemd-slices = ./slices.nix; systemd-timers = ./timers.nix; } diff --git a/tests/modules/systemd/slices.nix b/tests/modules/systemd/slices.nix new file mode 100644 index 00000000..0bb90504 --- /dev/null +++ b/tests/modules/systemd/slices.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + systemd.user.slices.app-test = { + Unit = { Description = "Slice for a test app"; }; + + Slice = { + MemoryHigh = "30%"; + MemoryMax = "40%"; + }; + }; + + nmt.script = '' + sliceFile=home-files/.config/systemd/user/app-test.slice + assertFileExists $sliceFile + assertFileContent $sliceFile ${ + builtins.toFile "app-test-expected.conf" '' + [Slice] + MemoryHigh=30% + MemoryMax=40% + + [Unit] + Description=Slice for a test app + '' + } + ''; + }; +}