diff options
author | Markov Dmitry <markovdm@ecotelecom.ru> | 2016-12-20 09:21:52 +0300 |
---|---|---|
committer | Jörg Thalheim <joerg@higgsboson.tk> | 2016-12-20 10:49:08 +0100 |
commit | efd5508b8998667dd04a090bc43f8ab6683d4f52 (patch) | |
tree | 13aacc1fef3db57eb0a987af83557e886d102e6a /nixos/modules/system/boot/systemd.nix | |
parent | ccbce6b11ab0e47c2f701f2539f989a7fd323687 (diff) | |
download | nixlib-efd5508b8998667dd04a090bc43f8ab6683d4f52.tar nixlib-efd5508b8998667dd04a090bc43f8ab6683d4f52.tar.gz nixlib-efd5508b8998667dd04a090bc43f8ab6683d4f52.tar.bz2 nixlib-efd5508b8998667dd04a090bc43f8ab6683d4f52.tar.lz nixlib-efd5508b8998667dd04a090bc43f8ab6683d4f52.tar.xz nixlib-efd5508b8998667dd04a090bc43f8ab6683d4f52.tar.zst nixlib-efd5508b8998667dd04a090bc43f8ab6683d4f52.zip |
systemd: add slice support
Diffstat (limited to 'nixos/modules/system/boot/systemd.nix')
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index d1f3f923e5e3..a2ee51669715 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -375,6 +375,15 @@ let ''; }; + sliceToUnit = name: def: + { inherit (def) wantedBy requiredBy enable; + text = commonUnitText def + + '' + [Slice] + ${attrsToSection def.sliceConfig} + ''; + }; + in { @@ -458,6 +467,12 @@ in ''; }; + systemd.slices = mkOption { + default = {}; + type = with types; attrsOf (submodule [ { options = sliceOptions; } unitConfig] ); + description = "Definition of slice configurations."; + }; + systemd.generators = mkOption { type = types.attrsOf types.path; default = {}; @@ -748,6 +763,7 @@ in // mapAttrs' (n: v: nameValuePair "${n}.socket" (socketToUnit n v)) cfg.sockets // mapAttrs' (n: v: nameValuePair "${n}.timer" (timerToUnit n v)) cfg.timers // mapAttrs' (n: v: nameValuePair "${n}.path" (pathToUnit n v)) cfg.paths + // mapAttrs' (n: v: nameValuePair "${n}.slice" (sliceToUnit n v)) cfg.slices // listToAttrs (map (v: let n = escapeSystemdPath v.where; in nameValuePair "${n}.mount" (mountToUnit n v)) cfg.mounts) |