2021-11-20 18:34:13 +01:00
|
|
|
|
{ lib, systemdUtils }:
|
2012-08-06 17:45:59 +02:00
|
|
|
|
|
2021-11-20 18:34:13 +01:00
|
|
|
|
with systemdUtils.lib;
|
2014-04-14 16:26:48 +02:00
|
|
|
|
with lib;
|
2012-08-06 17:45:59 +02:00
|
|
|
|
|
2013-10-30 15:33:20 +01:00
|
|
|
|
let
|
2014-11-20 10:41:05 +01:00
|
|
|
|
checkService = checkUnitConfig "Service" [
|
|
|
|
|
(assertValueOneOf "Type" [
|
2019-07-15 14:28:26 +02:00
|
|
|
|
"exec" "simple" "forking" "oneshot" "dbus" "notify" "idle"
|
2014-11-20 10:41:05 +01:00
|
|
|
|
])
|
|
|
|
|
(assertValueOneOf "Restart" [
|
2015-01-19 11:41:18 +01:00
|
|
|
|
"no" "on-success" "on-failure" "on-abnormal" "on-abort" "always"
|
2014-11-20 10:41:05 +01:00
|
|
|
|
])
|
|
|
|
|
];
|
|
|
|
|
|
2015-04-19 21:05:12 +02:00
|
|
|
|
in rec {
|
2013-10-30 15:33:20 +01:00
|
|
|
|
|
2013-11-18 15:45:24 +01:00
|
|
|
|
unitOption = mkOptionType {
|
|
|
|
|
name = "systemd option";
|
2016-03-01 20:47:08 +01:00
|
|
|
|
merge = loc: defs:
|
2013-11-18 15:51:21 +01:00
|
|
|
|
let
|
|
|
|
|
defs' = filterOverrides defs;
|
|
|
|
|
defs'' = getValues defs';
|
2013-11-18 15:45:24 +01:00
|
|
|
|
in
|
2013-11-18 15:51:21 +01:00
|
|
|
|
if isList (head defs'')
|
|
|
|
|
then concatLists defs''
|
2019-11-08 16:45:44 +01:00
|
|
|
|
else mergeEqualOption loc defs';
|
2013-11-18 15:45:24 +01:00
|
|
|
|
};
|
|
|
|
|
|
2014-04-17 23:35:05 +02:00
|
|
|
|
sharedOptions = {
|
2012-08-06 17:45:59 +02:00
|
|
|
|
|
2012-10-29 21:01:36 +01:00
|
|
|
|
enable = mkOption {
|
|
|
|
|
default = true;
|
2013-10-28 15:12:11 +01:00
|
|
|
|
type = types.bool;
|
2012-10-29 21:01:36 +01:00
|
|
|
|
description = ''
|
|
|
|
|
If set to false, this unit will be a symlink to
|
|
|
|
|
/dev/null. This is primarily useful to prevent specific
|
2017-09-16 12:48:16 +02:00
|
|
|
|
template instances
|
|
|
|
|
(e.g. <literal>serial-getty@ttyS0</literal>) from being
|
|
|
|
|
started. Note that <literal>enable=true</literal> does not
|
|
|
|
|
make a unit start by default at boot; if you want that, see
|
|
|
|
|
<literal>wantedBy</literal>.
|
2012-10-29 21:01:36 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2014-04-17 23:35:05 +02:00
|
|
|
|
requiredBy = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2017-09-16 12:48:16 +02:00
|
|
|
|
description = ''
|
|
|
|
|
Units that require (i.e. depend on and need to go down with)
|
|
|
|
|
this unit. The discussion under <literal>wantedBy</literal>
|
|
|
|
|
applies here as well: inverse <literal>.requires</literal>
|
|
|
|
|
symlinks are established.
|
|
|
|
|
'';
|
2014-04-17 23:35:05 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
wantedBy = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2017-09-16 12:48:16 +02:00
|
|
|
|
description = ''
|
|
|
|
|
Units that want (i.e. depend on) this unit. The standard way
|
|
|
|
|
to make a unit start by default at boot is to set this option
|
|
|
|
|
to <literal>[ "multi-user.target" ]</literal>. That's despite
|
|
|
|
|
the fact that the systemd.unit(5) manpage says this option
|
|
|
|
|
goes in the <literal>[Install]</literal> section that controls
|
|
|
|
|
the behaviour of <literal>systemctl enable</literal>. Since
|
|
|
|
|
such a process is stateful and thus contrary to the design of
|
|
|
|
|
NixOS, setting this option instead causes the equivalent
|
|
|
|
|
inverse <literal>.wants</literal> symlink to be present,
|
|
|
|
|
establishing the same desired relationship in a stateless way.
|
|
|
|
|
'';
|
2014-04-17 23:35:05 +02:00
|
|
|
|
};
|
|
|
|
|
|
2017-02-01 22:51:16 +01:00
|
|
|
|
aliases = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2017-02-01 22:51:16 +01:00
|
|
|
|
description = "Aliases of that unit.";
|
|
|
|
|
};
|
|
|
|
|
|
2014-04-17 23:35:05 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
concreteUnitOptions = sharedOptions // {
|
|
|
|
|
|
|
|
|
|
text = mkOption {
|
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
|
default = null;
|
|
|
|
|
description = "Text of this systemd unit.";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
unit = mkOption {
|
|
|
|
|
internal = true;
|
|
|
|
|
description = "The generated unit.";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
commonUnitOptions = sharedOptions // {
|
|
|
|
|
|
2012-08-06 17:45:59 +02:00
|
|
|
|
description = mkOption {
|
|
|
|
|
default = "";
|
2022-01-27 17:07:31 +01:00
|
|
|
|
type = types.singleLineStr;
|
2012-08-06 17:45:59 +02:00
|
|
|
|
description = "Description of this unit used in systemd messages and progress indicators.";
|
|
|
|
|
};
|
|
|
|
|
|
2016-04-27 04:56:40 +02:00
|
|
|
|
documentation = mkOption {
|
|
|
|
|
default = [];
|
|
|
|
|
type = types.listOf types.str;
|
|
|
|
|
description = "A list of URIs referencing documentation for this unit or its configuration.";
|
|
|
|
|
};
|
|
|
|
|
|
2012-08-06 17:45:59 +02:00
|
|
|
|
requires = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2012-08-06 17:45:59 +02:00
|
|
|
|
description = ''
|
|
|
|
|
Start the specified units when this unit is started, and stop
|
|
|
|
|
this unit when the specified units are stopped or fail.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
wants = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2012-08-06 17:45:59 +02:00
|
|
|
|
description = ''
|
|
|
|
|
Start the specified units when this unit is started.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
after = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2012-08-06 17:45:59 +02:00
|
|
|
|
description = ''
|
|
|
|
|
If the specified units are started at the same time as
|
|
|
|
|
this unit, delay this unit until they have started.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
before = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2012-08-06 17:45:59 +02:00
|
|
|
|
description = ''
|
|
|
|
|
If the specified units are started at the same time as
|
|
|
|
|
this unit, delay them until this unit has started.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2012-10-10 22:50:41 +02:00
|
|
|
|
bindsTo = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2012-10-10 22:50:41 +02:00
|
|
|
|
description = ''
|
|
|
|
|
Like ‘requires’, but in addition, if the specified units
|
|
|
|
|
unexpectedly disappear, this unit will be stopped as well.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2012-08-15 21:36:54 +02:00
|
|
|
|
partOf = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2012-08-15 21:36:54 +02:00
|
|
|
|
description = ''
|
|
|
|
|
If the specified units are stopped or restarted, then this
|
|
|
|
|
unit is stopped or restarted as well.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2013-09-22 21:04:54 +02:00
|
|
|
|
conflicts = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2013-09-22 21:04:54 +02:00
|
|
|
|
description = ''
|
|
|
|
|
If the specified units are started, then this unit is stopped
|
|
|
|
|
and vice versa.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2014-11-19 22:11:30 +01:00
|
|
|
|
requisite = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2014-11-19 22:11:30 +01:00
|
|
|
|
description = ''
|
|
|
|
|
Similar to requires. However if the units listed are not started,
|
|
|
|
|
they will not be started and the transaction will fail.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2012-10-02 00:58:11 +02:00
|
|
|
|
unitConfig = mkOption {
|
|
|
|
|
default = {};
|
|
|
|
|
example = { RequiresMountsFor = "/data"; };
|
2013-11-18 15:45:24 +01:00
|
|
|
|
type = types.attrsOf unitOption;
|
2012-10-02 00:58:11 +02:00
|
|
|
|
description = ''
|
|
|
|
|
Each attribute in this set specifies an option in the
|
|
|
|
|
<literal>[Unit]</literal> section of the unit. See
|
|
|
|
|
<citerefentry><refentrytitle>systemd.unit</refentrytitle>
|
|
|
|
|
<manvolnum>5</manvolnum></citerefentry> for details.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2012-10-11 23:54:43 +02:00
|
|
|
|
restartTriggers = mkOption {
|
|
|
|
|
default = [];
|
2014-03-12 18:35:50 +01:00
|
|
|
|
type = types.listOf types.unspecified;
|
2012-10-11 23:54:43 +02:00
|
|
|
|
description = ''
|
|
|
|
|
An arbitrary list of items such as derivations. If any item
|
|
|
|
|
in the list changes between reconfigurations, the service will
|
|
|
|
|
be restarted.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2022-01-29 23:01:24 +01:00
|
|
|
|
reloadTriggers = mkOption {
|
|
|
|
|
default = [];
|
|
|
|
|
type = types.listOf unitOption;
|
|
|
|
|
description = ''
|
|
|
|
|
An arbitrary list of items such as derivations. If any item
|
|
|
|
|
in the list changes between reconfigurations, the service will
|
|
|
|
|
be reloaded. If anything but a reload trigger changes in the
|
|
|
|
|
unit file, the unit will be restarted instead.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2015-11-16 15:07:10 +01:00
|
|
|
|
onFailure = mkOption {
|
|
|
|
|
default = [];
|
2021-12-27 13:00:00 +01:00
|
|
|
|
type = types.listOf unitNameType;
|
2015-11-16 15:07:10 +01:00
|
|
|
|
description = ''
|
|
|
|
|
A list of one or more units that are activated when
|
|
|
|
|
this unit enters the "failed" state.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-09 09:31:27 +02:00
|
|
|
|
startLimitBurst = mkOption {
|
|
|
|
|
type = types.int;
|
|
|
|
|
description = ''
|
|
|
|
|
Configure unit start rate limiting. Units which are started
|
|
|
|
|
more than startLimitBurst times within an interval time
|
|
|
|
|
interval are not permitted to start any more.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2018-11-20 18:34:43 +01:00
|
|
|
|
startLimitIntervalSec = mkOption {
|
|
|
|
|
type = types.int;
|
|
|
|
|
description = ''
|
|
|
|
|
Configure unit start rate limiting. Units which are started
|
2020-09-09 09:31:27 +02:00
|
|
|
|
more than startLimitBurst times within an interval time
|
|
|
|
|
interval are not permitted to start any more.
|
2018-11-20 18:34:43 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2012-10-02 00:58:11 +02:00
|
|
|
|
};
|
|
|
|
|
|
2012-10-09 21:14:15 +02:00
|
|
|
|
|
2014-04-17 23:35:05 +02:00
|
|
|
|
serviceOptions = commonUnitOptions // {
|
2012-10-02 00:58:11 +02:00
|
|
|
|
|
2012-08-06 17:45:59 +02:00
|
|
|
|
environment = mkOption {
|
|
|
|
|
default = {};
|
2019-08-08 23:35:52 +02:00
|
|
|
|
type = with types; attrsOf (nullOr (oneOf [ str path package ]));
|
2012-08-06 17:45:59 +02:00
|
|
|
|
example = { PATH = "/foo/bar/bin"; LANG = "nl_NL.UTF-8"; };
|
2013-08-10 23:07:13 +02:00
|
|
|
|
description = "Environment variables passed to the service's processes.";
|
2012-08-06 17:45:59 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
path = mkOption {
|
|
|
|
|
default = [];
|
2020-06-19 00:02:51 +02:00
|
|
|
|
type = with types; listOf (oneOf [ package str ]);
|
2012-08-06 17:45:59 +02:00
|
|
|
|
description = ''
|
|
|
|
|
Packages added to the service's <envar>PATH</envar>
|
|
|
|
|
environment variable. Both the <filename>bin</filename>
|
|
|
|
|
and <filename>sbin</filename> subdirectories of each
|
|
|
|
|
package are added.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
serviceConfig = mkOption {
|
2012-10-01 22:27:42 +02:00
|
|
|
|
default = {};
|
|
|
|
|
example =
|
2020-09-09 09:31:27 +02:00
|
|
|
|
{ RestartSec = 5;
|
2012-10-01 22:27:42 +02:00
|
|
|
|
};
|
2013-11-18 15:45:24 +01:00
|
|
|
|
type = types.addCheck (types.attrsOf unitOption) checkService;
|
2012-08-06 17:45:59 +02:00
|
|
|
|
description = ''
|
2012-10-01 22:27:42 +02:00
|
|
|
|
Each attribute in this set specifies an option in the
|
|
|
|
|
<literal>[Service]</literal> section of the unit. See
|
|
|
|
|
<citerefentry><refentrytitle>systemd.service</refentrytitle>
|
2012-08-06 17:45:59 +02:00
|
|
|
|
<manvolnum>5</manvolnum></citerefentry> for details.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
script = mkOption {
|
2013-11-18 15:48:37 +01:00
|
|
|
|
type = types.lines;
|
2012-08-06 17:45:59 +02:00
|
|
|
|
default = "";
|
|
|
|
|
description = "Shell commands executed as the service's main process.";
|
|
|
|
|
};
|
|
|
|
|
|
2013-02-15 03:50:41 +01:00
|
|
|
|
scriptArgs = mkOption {
|
2013-10-30 11:02:04 +01:00
|
|
|
|
type = types.str;
|
2013-02-15 03:50:41 +01:00
|
|
|
|
default = "";
|
|
|
|
|
description = "Arguments passed to the main process script.";
|
|
|
|
|
};
|
|
|
|
|
|
2012-08-06 17:45:59 +02:00
|
|
|
|
preStart = mkOption {
|
2013-11-18 15:48:37 +01:00
|
|
|
|
type = types.lines;
|
2012-08-06 17:45:59 +02:00
|
|
|
|
default = "";
|
|
|
|
|
description = ''
|
|
|
|
|
Shell commands executed before the service's main process
|
|
|
|
|
is started.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2012-10-01 22:45:49 +02:00
|
|
|
|
postStart = mkOption {
|
2013-11-18 15:48:37 +01:00
|
|
|
|
type = types.lines;
|
2012-10-01 22:45:49 +02:00
|
|
|
|
default = "";
|
|
|
|
|
description = ''
|
|
|
|
|
Shell commands executed after the service's main process
|
|
|
|
|
is started.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2014-09-16 05:03:20 +02:00
|
|
|
|
reload = mkOption {
|
|
|
|
|
type = types.lines;
|
|
|
|
|
default = "";
|
|
|
|
|
description = ''
|
|
|
|
|
Shell commands executed when the service's main process
|
|
|
|
|
is reloaded.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2013-11-26 18:24:55 +01:00
|
|
|
|
preStop = mkOption {
|
|
|
|
|
type = types.lines;
|
|
|
|
|
default = "";
|
|
|
|
|
description = ''
|
|
|
|
|
Shell commands executed to stop the service.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2012-10-10 23:55:13 +02:00
|
|
|
|
postStop = mkOption {
|
2013-11-18 15:48:37 +01:00
|
|
|
|
type = types.lines;
|
2012-10-10 23:55:13 +02:00
|
|
|
|
default = "";
|
|
|
|
|
description = ''
|
|
|
|
|
Shell commands executed after the service's main process
|
|
|
|
|
has exited.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2012-08-17 19:14:42 +02:00
|
|
|
|
restartIfChanged = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether the service should be restarted during a NixOS
|
|
|
|
|
configuration switch if its definition has changed.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2014-03-17 15:02:53 +01:00
|
|
|
|
reloadIfChanged = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether the service should be reloaded during a NixOS
|
|
|
|
|
configuration switch if its definition has changed. If
|
|
|
|
|
enabled, the value of <option>restartIfChanged</option> is
|
|
|
|
|
ignored.
|
2022-01-29 23:01:24 +01:00
|
|
|
|
|
|
|
|
|
This option should not be used anymore in favor of
|
|
|
|
|
<option>reloadTriggers</option> which allows more granular
|
|
|
|
|
control of when a service is reloaded and when a service
|
|
|
|
|
is restarted.
|
2014-03-17 15:02:53 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2013-01-05 01:05:25 +01:00
|
|
|
|
stopIfChanged = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
|
|
|
|
If set, a changed unit is restarted by calling
|
|
|
|
|
<command>systemctl stop</command> in the old configuration,
|
|
|
|
|
then <command>systemctl start</command> in the new one.
|
|
|
|
|
Otherwise, it is restarted in a single step using
|
|
|
|
|
<command>systemctl restart</command> in the new configuration.
|
|
|
|
|
The latter is less correct because it runs the
|
|
|
|
|
<literal>ExecStop</literal> commands from the new
|
|
|
|
|
configuration.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-09 14:28:35 +02:00
|
|
|
|
startAt = mkOption {
|
2016-09-01 00:39:36 +02:00
|
|
|
|
type = with types; either str (listOf str);
|
2016-10-19 02:06:32 +02:00
|
|
|
|
default = [];
|
2013-10-09 14:28:35 +02:00
|
|
|
|
example = "Sun 14:00:00";
|
|
|
|
|
description = ''
|
|
|
|
|
Automatically start this unit at the given date/time, which
|
|
|
|
|
must be in the format described in
|
|
|
|
|
<citerefentry><refentrytitle>systemd.time</refentrytitle>
|
2017-03-21 08:27:56 +01:00
|
|
|
|
<manvolnum>7</manvolnum></citerefentry>. This is equivalent
|
2013-10-09 14:28:35 +02:00
|
|
|
|
to adding a corresponding timer unit with
|
|
|
|
|
<option>OnCalendar</option> set to the value given here.
|
|
|
|
|
'';
|
2016-10-19 02:06:32 +02:00
|
|
|
|
apply = v: if isList v then v else [ v ];
|
2013-10-09 14:28:35 +02:00
|
|
|
|
};
|
|
|
|
|
|
2012-08-06 17:45:59 +02:00
|
|
|
|
};
|
|
|
|
|
|
2012-10-09 21:14:15 +02:00
|
|
|
|
|
2014-04-17 23:35:05 +02:00
|
|
|
|
socketOptions = commonUnitOptions // {
|
2012-10-09 21:14:15 +02:00
|
|
|
|
|
2013-05-14 16:07:55 +02:00
|
|
|
|
listenStreams = mkOption {
|
|
|
|
|
default = [];
|
2013-11-18 15:48:37 +01:00
|
|
|
|
type = types.listOf types.str;
|
2013-05-14 16:07:55 +02:00
|
|
|
|
example = [ "0.0.0.0:993" "/run/my-socket" ];
|
|
|
|
|
description = ''
|
|
|
|
|
For each item in this list, a <literal>ListenStream</literal>
|
|
|
|
|
option in the <literal>[Socket]</literal> section will be created.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2020-08-11 23:46:39 +02:00
|
|
|
|
listenDatagrams = mkOption {
|
|
|
|
|
default = [];
|
|
|
|
|
type = types.listOf types.str;
|
|
|
|
|
example = [ "0.0.0.0:993" "/run/my-socket" ];
|
|
|
|
|
description = ''
|
|
|
|
|
For each item in this list, a <literal>ListenDatagram</literal>
|
|
|
|
|
option in the <literal>[Socket]</literal> section will be created.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2012-10-09 21:14:15 +02:00
|
|
|
|
socketConfig = mkOption {
|
|
|
|
|
default = {};
|
|
|
|
|
example = { ListenStream = "/run/my-socket"; };
|
2013-11-18 15:45:24 +01:00
|
|
|
|
type = types.attrsOf unitOption;
|
2012-10-09 21:14:15 +02:00
|
|
|
|
description = ''
|
|
|
|
|
Each attribute in this set specifies an option in the
|
|
|
|
|
<literal>[Socket]</literal> section of the unit. See
|
|
|
|
|
<citerefentry><refentrytitle>systemd.socket</refentrytitle>
|
|
|
|
|
<manvolnum>5</manvolnum></citerefentry> for details.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2013-03-02 01:03:13 +01:00
|
|
|
|
|
2014-04-17 23:35:05 +02:00
|
|
|
|
timerOptions = commonUnitOptions // {
|
2013-03-02 01:03:13 +01:00
|
|
|
|
|
|
|
|
|
timerConfig = mkOption {
|
|
|
|
|
default = {};
|
|
|
|
|
example = { OnCalendar = "Sun 14:00:00"; Unit = "foo.service"; };
|
2013-11-18 15:45:24 +01:00
|
|
|
|
type = types.attrsOf unitOption;
|
2013-03-02 01:03:13 +01:00
|
|
|
|
description = ''
|
|
|
|
|
Each attribute in this set specifies an option in the
|
|
|
|
|
<literal>[Timer]</literal> section of the unit. See
|
|
|
|
|
<citerefentry><refentrytitle>systemd.timer</refentrytitle>
|
2018-10-03 14:39:36 +02:00
|
|
|
|
<manvolnum>5</manvolnum></citerefentry> and
|
2013-03-02 01:03:13 +01:00
|
|
|
|
<citerefentry><refentrytitle>systemd.time</refentrytitle>
|
2017-03-21 08:27:56 +01:00
|
|
|
|
<manvolnum>7</manvolnum></citerefentry> for details.
|
2013-03-02 01:03:13 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2014-04-17 23:35:05 +02:00
|
|
|
|
pathOptions = commonUnitOptions // {
|
2014-03-31 12:23:27 +02:00
|
|
|
|
|
|
|
|
|
pathConfig = mkOption {
|
|
|
|
|
default = {};
|
|
|
|
|
example = { PathChanged = "/some/path"; Unit = "changedpath.service"; };
|
|
|
|
|
type = types.attrsOf unitOption;
|
|
|
|
|
description = ''
|
|
|
|
|
Each attribute in this set specifies an option in the
|
|
|
|
|
<literal>[Path]</literal> section of the unit. See
|
|
|
|
|
<citerefentry><refentrytitle>systemd.path</refentrytitle>
|
|
|
|
|
<manvolnum>5</manvolnum></citerefentry> for details.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2014-04-17 23:35:05 +02:00
|
|
|
|
mountOptions = commonUnitOptions // {
|
2012-12-28 13:29:53 +01:00
|
|
|
|
|
|
|
|
|
what = mkOption {
|
|
|
|
|
example = "/dev/sda1";
|
2013-10-30 11:02:04 +01:00
|
|
|
|
type = types.str;
|
2012-12-28 13:29:53 +01:00
|
|
|
|
description = "Absolute path of device node, file or other resource. (Mandatory)";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
where = mkOption {
|
|
|
|
|
example = "/mnt";
|
2013-10-30 11:02:04 +01:00
|
|
|
|
type = types.str;
|
2012-12-28 13:29:53 +01:00
|
|
|
|
description = ''
|
|
|
|
|
Absolute path of a directory of the mount point.
|
|
|
|
|
Will be created if it doesn't exist. (Mandatory)
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type = mkOption {
|
|
|
|
|
default = "";
|
|
|
|
|
example = "ext4";
|
2013-10-30 11:02:04 +01:00
|
|
|
|
type = types.str;
|
2012-12-28 13:29:53 +01:00
|
|
|
|
description = "File system type.";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
options = mkOption {
|
|
|
|
|
default = "";
|
|
|
|
|
example = "noatime";
|
2013-10-28 16:14:15 +01:00
|
|
|
|
type = types.commas;
|
2012-12-28 13:29:53 +01:00
|
|
|
|
description = "Options used to mount the file system.";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
mountConfig = mkOption {
|
|
|
|
|
default = {};
|
|
|
|
|
example = { DirectoryMode = "0775"; };
|
2013-11-18 15:45:24 +01:00
|
|
|
|
type = types.attrsOf unitOption;
|
2012-12-28 13:29:53 +01:00
|
|
|
|
description = ''
|
|
|
|
|
Each attribute in this set specifies an option in the
|
|
|
|
|
<literal>[Mount]</literal> section of the unit. See
|
|
|
|
|
<citerefentry><refentrytitle>systemd.mount</refentrytitle>
|
|
|
|
|
<manvolnum>5</manvolnum></citerefentry> for details.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2014-04-17 23:35:05 +02:00
|
|
|
|
automountOptions = commonUnitOptions // {
|
2013-09-23 22:56:05 +02:00
|
|
|
|
|
|
|
|
|
where = mkOption {
|
|
|
|
|
example = "/mnt";
|
2013-10-30 11:02:04 +01:00
|
|
|
|
type = types.str;
|
2013-09-23 22:56:05 +02:00
|
|
|
|
description = ''
|
|
|
|
|
Absolute path of a directory of the mount point.
|
|
|
|
|
Will be created if it doesn't exist. (Mandatory)
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
automountConfig = mkOption {
|
|
|
|
|
default = {};
|
|
|
|
|
example = { DirectoryMode = "0775"; };
|
2013-11-18 15:45:24 +01:00
|
|
|
|
type = types.attrsOf unitOption;
|
2013-09-23 22:56:05 +02:00
|
|
|
|
description = ''
|
|
|
|
|
Each attribute in this set specifies an option in the
|
|
|
|
|
<literal>[Automount]</literal> section of the unit. See
|
|
|
|
|
<citerefentry><refentrytitle>systemd.automount</refentrytitle>
|
|
|
|
|
<manvolnum>5</manvolnum></citerefentry> for details.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2014-04-17 23:35:05 +02:00
|
|
|
|
targetOptions = commonUnitOptions;
|
|
|
|
|
|
2016-12-20 07:21:52 +01:00
|
|
|
|
sliceOptions = commonUnitOptions // {
|
|
|
|
|
|
|
|
|
|
sliceConfig = mkOption {
|
|
|
|
|
default = {};
|
|
|
|
|
example = { MemoryMax = "2G"; };
|
|
|
|
|
type = types.attrsOf unitOption;
|
|
|
|
|
description = ''
|
|
|
|
|
Each attribute in this set specifies an option in the
|
|
|
|
|
<literal>[Slice]</literal> section of the unit. See
|
|
|
|
|
<citerefentry><refentrytitle>systemd.slice</refentrytitle>
|
|
|
|
|
<manvolnum>5</manvolnum></citerefentry> for details.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2013-02-15 03:50:41 +01:00
|
|
|
|
}
|