Skip to content

Commit 5cb11ab

Browse files
committedJul 13, 2017
systemd: paths and slices are supported for user units too
1 parent eb28340 commit 5cb11ab

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed
 

‎nixos/modules/system/boot/systemd.nix

+23-9
Original file line numberDiff line numberDiff line change
@@ -659,16 +659,22 @@ in
659659
}));
660660
};
661661

662+
systemd.user.paths = mkOption {
663+
default = {};
664+
type = with types; attrsOf (submodule [ { options = pathOptions; } unitConfig ]);
665+
description = "Definition of systemd per-user path units.";
666+
};
667+
662668
systemd.user.services = mkOption {
663669
default = {};
664670
type = with types; attrsOf (submodule [ { options = serviceOptions; } unitConfig serviceConfig ] );
665671
description = "Definition of systemd per-user service units.";
666672
};
667673

668-
systemd.user.timers = mkOption {
674+
systemd.user.slices = mkOption {
669675
default = {};
670-
type = with types; attrsOf (submodule [ { options = timerOptions; } unitConfig ] );
671-
description = "Definition of systemd per-user timer units.";
676+
type = with types; attrsOf (submodule [ { options = sliceOptions; } unitConfig ] );
677+
description = "Definition of systemd per-user slice units.";
672678
};
673679

674680
systemd.user.sockets = mkOption {
@@ -683,6 +689,12 @@ in
683689
description = "Definition of systemd per-user target units.";
684690
};
685691

692+
systemd.user.timers = mkOption {
693+
default = {};
694+
type = with types; attrsOf (submodule [ { options = timerOptions; } unitConfig ] );
695+
description = "Definition of systemd per-user timer units.";
696+
};
697+
686698
systemd.additionalUpstreamSystemUnits = mkOption {
687699
default = [ ];
688700
type = types.listOf types.str;
@@ -799,12 +811,12 @@ in
799811
};
800812

801813
systemd.units =
802-
mapAttrs' (n: v: nameValuePair "${n}.target" (targetToUnit n v)) cfg.targets
814+
mapAttrs' (n: v: nameValuePair "${n}.path" (pathToUnit n v)) cfg.paths
803815
// mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.services
804-
// mapAttrs' (n: v: nameValuePair "${n}.socket" (socketToUnit n v)) cfg.sockets
805-
// mapAttrs' (n: v: nameValuePair "${n}.timer" (timerToUnit n v)) cfg.timers
806-
// mapAttrs' (n: v: nameValuePair "${n}.path" (pathToUnit n v)) cfg.paths
807-
// mapAttrs' (n: v: nameValuePair "${n}.slice" (sliceToUnit n v)) cfg.slices
816+
// mapAttrs' (n: v: nameValuePair "${n}.slice" (sliceToUnit n v)) cfg.slices
817+
// mapAttrs' (n: v: nameValuePair "${n}.socket" (socketToUnit n v)) cfg.sockets
818+
// mapAttrs' (n: v: nameValuePair "${n}.target" (targetToUnit n v)) cfg.targets
819+
// mapAttrs' (n: v: nameValuePair "${n}.timer" (timerToUnit n v)) cfg.timers
808820
// listToAttrs (map
809821
(v: let n = escapeSystemdPath v.where;
810822
in nameValuePair "${n}.mount" (mountToUnit n v)) cfg.mounts)
@@ -813,7 +825,9 @@ in
813825
in nameValuePair "${n}.automount" (automountToUnit n v)) cfg.automounts);
814826

815827
systemd.user.units =
816-
mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.user.services
828+
mapAttrs' (n: v: nameValuePair "${n}.path" (pathToUnit n v)) cfg.user.paths
829+
// mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.user.services
830+
// mapAttrs' (n: v: nameValuePair "${n}.slice" (sliceToUnit n v)) cfg.user.slices
817831
// mapAttrs' (n: v: nameValuePair "${n}.socket" (socketToUnit n v)) cfg.user.sockets
818832
// mapAttrs' (n: v: nameValuePair "${n}.target" (targetToUnit n v)) cfg.user.targets
819833
// mapAttrs' (n: v: nameValuePair "${n}.timer" (timerToUnit n v)) cfg.user.timers;

0 commit comments

Comments
 (0)
Please sign in to comment.