mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
systemd: merge unit definitions recursively
This removes the need for monolithic unit definitions and allows users to modify existing units. Example: ``` { systemd.user.services.owncloud-client.Unit.OnFailure = "my-notify-service"; } ```
This commit is contained in:
parent
394045f68a
commit
73b8aa8bcc
1 changed files with 24 additions and 8 deletions
|
@ -50,6 +50,10 @@ let
|
|||
|
||||
servicesStartTimeoutMs = builtins.toString cfg.servicesStartTimeoutMs;
|
||||
|
||||
attrsRecursivelyMerged = types.attrs // {
|
||||
merge = loc: foldl' (res: def: recursiveUpdate res def.value) {};
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
@ -70,26 +74,38 @@ in
|
|||
|
||||
services = mkOption {
|
||||
default = {};
|
||||
type = types.attrs;
|
||||
description = "Definition of systemd per-user service units.";
|
||||
type = attrsRecursivelyMerged;
|
||||
description = ''
|
||||
Definition of systemd per-user service units. Attributes are
|
||||
merged recursively.
|
||||
'';
|
||||
};
|
||||
|
||||
sockets = mkOption {
|
||||
default = {};
|
||||
type = types.attrs;
|
||||
description = "Definition of systemd per-user sockets";
|
||||
type = attrsRecursivelyMerged;
|
||||
description = ''
|
||||
Definition of systemd per-user sockets. Attributes are
|
||||
merged recursively.
|
||||
'';
|
||||
};
|
||||
|
||||
targets = mkOption {
|
||||
default = {};
|
||||
type = types.attrs;
|
||||
description = "Definition of systemd per-user targets";
|
||||
type = attrsRecursivelyMerged;
|
||||
description = ''
|
||||
Definition of systemd per-user targets. Attributes are
|
||||
merged recursively.
|
||||
'';
|
||||
};
|
||||
|
||||
timers = mkOption {
|
||||
default = {};
|
||||
type = types.attrs;
|
||||
description = "Definition of systemd per-user timers";
|
||||
type = attrsRecursivelyMerged;
|
||||
description = ''
|
||||
Definition of systemd per-user timers. Attributes are merged
|
||||
recursively.
|
||||
'';
|
||||
};
|
||||
|
||||
startServices = mkOption {
|
||||
|
|
Loading…
Reference in a new issue