Merge pull request #19069 from peterhoeg/targets
systemd: add user target support
This commit is contained in:
commit
e5c6f35a49
|
@ -77,6 +77,12 @@ in rec {
|
||||||
description = "Description of this unit used in systemd messages and progress indicators.";
|
description = "Description of this unit used in systemd messages and progress indicators.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
documentation = mkOption {
|
||||||
|
default = [];
|
||||||
|
type = types.listOf types.str;
|
||||||
|
description = "A list of URIs referencing documentation for this unit or its configuration.";
|
||||||
|
};
|
||||||
|
|
||||||
requires = mkOption {
|
requires = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
|
|
|
@ -185,6 +185,8 @@ let
|
||||||
"timers.target"
|
"timers.target"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
boolToString = value: if value then "yes" else "no";
|
||||||
|
|
||||||
makeJobScript = name: text:
|
makeJobScript = name: text:
|
||||||
let mkScriptName = s: (replaceChars [ "\\" ] [ "-" ] (shellEscape s) );
|
let mkScriptName = s: (replaceChars [ "\\" ] [ "-" ] (shellEscape s) );
|
||||||
x = pkgs.writeTextFile { name = "unit-script"; executable = true; destination = "/bin/${mkScriptName name}"; inherit text; };
|
x = pkgs.writeTextFile { name = "unit-script"; executable = true; destination = "/bin/${mkScriptName name}"; inherit text; };
|
||||||
|
@ -212,8 +214,10 @@ let
|
||||||
// optionalAttrs (config.restartTriggers != [])
|
// optionalAttrs (config.restartTriggers != [])
|
||||||
{ X-Restart-Triggers = toString config.restartTriggers; }
|
{ X-Restart-Triggers = toString config.restartTriggers; }
|
||||||
// optionalAttrs (config.description != "") {
|
// optionalAttrs (config.description != "") {
|
||||||
Description = config.description;
|
Description = config.description; }
|
||||||
} // optionalAttrs (config.onFailure != []) {
|
// optionalAttrs (config.documentation != []) {
|
||||||
|
Documentation = toString config.documentation; }
|
||||||
|
// optionalAttrs (config.onFailure != []) {
|
||||||
OnFailure = toString config.onFailure;
|
OnFailure = toString config.onFailure;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -620,6 +624,12 @@ in
|
||||||
description = "Definition of systemd per-user socket units.";
|
description = "Definition of systemd per-user socket units.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.user.targets = mkOption {
|
||||||
|
default = {};
|
||||||
|
type = with types; attrsOf (submodule [ { options = targetOptions; } unitConfig] );
|
||||||
|
description = "Definition of systemd per-user target units.";
|
||||||
|
};
|
||||||
|
|
||||||
systemd.additionalUpstreamSystemUnits = mkOption {
|
systemd.additionalUpstreamSystemUnits = mkOption {
|
||||||
default = [ ];
|
default = [ ];
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
|
@ -748,6 +758,7 @@ in
|
||||||
systemd.user.units =
|
systemd.user.units =
|
||||||
mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.user.services
|
mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.user.services
|
||||||
// mapAttrs' (n: v: nameValuePair "${n}.socket" (socketToUnit n v)) cfg.user.sockets
|
// mapAttrs' (n: v: nameValuePair "${n}.socket" (socketToUnit n v)) cfg.user.sockets
|
||||||
|
// mapAttrs' (n: v: nameValuePair "${n}.target" (targetToUnit n v)) cfg.user.targets
|
||||||
// mapAttrs' (n: v: nameValuePair "${n}.timer" (timerToUnit n v)) cfg.user.timers;
|
// mapAttrs' (n: v: nameValuePair "${n}.timer" (timerToUnit n v)) cfg.user.timers;
|
||||||
|
|
||||||
system.requiredKernelConfig = map config.lib.kernelConfig.isEnabled
|
system.requiredKernelConfig = map config.lib.kernelConfig.isEnabled
|
||||||
|
|
Loading…
Reference in New Issue