2012-08-06 17:45:59 +02:00
|
|
|
{ config, pkgs }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
serviceOptions = {
|
|
|
|
|
|
|
|
description = mkOption {
|
|
|
|
default = "";
|
|
|
|
types = types.uniq types.string;
|
|
|
|
description = "Description of this unit used in systemd messages and progress indicators.";
|
|
|
|
};
|
|
|
|
|
|
|
|
requires = mkOption {
|
|
|
|
default = [];
|
|
|
|
types = types.listOf types.string;
|
|
|
|
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 = [];
|
|
|
|
types = types.listOf types.string;
|
|
|
|
description = ''
|
|
|
|
Start the specified units when this unit is started.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
after = mkOption {
|
|
|
|
default = [];
|
|
|
|
types = types.listOf types.string;
|
|
|
|
description = ''
|
|
|
|
If the specified units are started at the same time as
|
|
|
|
this unit, delay this unit until they have started.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
before = mkOption {
|
|
|
|
default = [];
|
|
|
|
types = types.listOf types.string;
|
|
|
|
description = ''
|
|
|
|
If the specified units are started at the same time as
|
|
|
|
this unit, delay them until this unit has started.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-08-15 21:36:54 +02:00
|
|
|
partOf = mkOption {
|
|
|
|
default = [];
|
|
|
|
types = types.listOf types.string;
|
|
|
|
description = ''
|
|
|
|
If the specified units are stopped or restarted, then this
|
|
|
|
unit is stopped or restarted as well.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-08-06 17:45:59 +02:00
|
|
|
wantedBy = mkOption {
|
|
|
|
default = [];
|
|
|
|
types = types.listOf types.string;
|
|
|
|
description = "Units that want (i.e. depend on) this unit.";
|
|
|
|
};
|
|
|
|
|
|
|
|
environment = mkOption {
|
|
|
|
default = {};
|
|
|
|
type = types.attrs;
|
|
|
|
example = { PATH = "/foo/bar/bin"; LANG = "nl_NL.UTF-8"; };
|
|
|
|
description = "Environment variables passed to the services's processes.";
|
|
|
|
};
|
|
|
|
|
|
|
|
path = mkOption {
|
|
|
|
default = [];
|
|
|
|
apply = ps: "${makeSearchPath "bin" ps}:${makeSearchPath "sbin" ps}";
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-08-11 00:56:12 +02:00
|
|
|
unitConfig = mkOption {
|
2012-10-01 22:27:42 +02:00
|
|
|
default = {};
|
|
|
|
example = { RequiresMountsFor = "/data"; };
|
|
|
|
type = types.attrs;
|
2012-08-11 00:56:12 +02:00
|
|
|
description = ''
|
2012-10-01 22:27:42 +02:00
|
|
|
Each attribute in this set specifies an option in the
|
|
|
|
<literal>[Unit]</literal> section of the unit. See
|
|
|
|
<citerefentry><refentrytitle>systemd.unit</refentrytitle>
|
2012-08-11 00:56:12 +02:00
|
|
|
<manvolnum>5</manvolnum></citerefentry> for details.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-08-06 17:45:59 +02:00
|
|
|
serviceConfig = mkOption {
|
2012-10-01 22:27:42 +02:00
|
|
|
default = {};
|
|
|
|
example =
|
|
|
|
{ StartLimitInterval = 10;
|
|
|
|
RestartSec = 5;
|
|
|
|
};
|
|
|
|
type = types.attrs;
|
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 {
|
|
|
|
type = types.uniq types.string;
|
|
|
|
default = "";
|
|
|
|
description = "Shell commands executed as the service's main process.";
|
|
|
|
};
|
|
|
|
|
|
|
|
preStart = mkOption {
|
|
|
|
type = types.string;
|
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
Shell commands executed before the service's main process
|
|
|
|
is started.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-10-01 22:45:49 +02:00
|
|
|
postStart = mkOption {
|
|
|
|
type = types.string;
|
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
Shell commands executed after the service's main process
|
|
|
|
is started.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-08-06 17:45:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|