Fix bogus mkOption types

Among others, systemd unit options were not being type-checked because
of this.  mkOption should really check its arguments better...
This commit is contained in:
Eelco Dolstra 2013-10-28 15:12:11 +01:00
parent 1408ac51a4
commit a40583e7e4
5 changed files with 25 additions and 25 deletions

View File

@ -32,13 +32,13 @@ in {
host = mkOption { host = mkOption {
description = "Graphite web frontend listen address"; description = "Graphite web frontend listen address";
default = "127.0.0.1"; default = "127.0.0.1";
types = type.uniq types.string; type = types.uniq types.string;
}; };
port = mkOption { port = mkOption {
description = "Graphite web frontend port"; description = "Graphite web frontend port";
default = "8080"; default = "8080";
types = type.uniq types.string; type = types.uniq types.string;
}; };
}; };

View File

@ -29,31 +29,31 @@ in {
host = mkOption { host = mkOption {
description = "Elasticsearch listen address"; description = "Elasticsearch listen address";
default = "127.0.0.1"; default = "127.0.0.1";
types = type.uniq types.string; type = types.uniq types.string;
}; };
port = mkOption { port = mkOption {
description = "Elasticsearch port to listen for HTTP traffic"; description = "Elasticsearch port to listen for HTTP traffic";
default = "9200"; default = "9200";
types = type.uniq types.string; type = types.uniq types.string;
}; };
tcp_port = mkOption { tcp_port = mkOption {
description = "Elasticsearch port for the node to node communication"; description = "Elasticsearch port for the node to node communication";
default = "9300"; default = "9300";
types = type.uniq types.string; type = types.uniq types.string;
}; };
cluster_name = mkOption { cluster_name = mkOption {
description = "Elasticsearch name that identifies your cluster for auto-discovery"; description = "Elasticsearch name that identifies your cluster for auto-discovery";
default = "elasticsearch"; default = "elasticsearch";
types = type.uniq types.string; type = types.uniq types.string;
}; };
extraConf = mkOption { extraConf = mkOption {
description = "Extra configuration for elasticsearch"; description = "Extra configuration for elasticsearch";
default = ""; default = "";
types = type.uniq types.string; type = types.uniq types.string;
example = '' example = ''
node.name: "elasticsearch" node.name: "elasticsearch"
node.master: true node.master: true
@ -77,7 +77,7 @@ in {
type: consolePattern type: consolePattern
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n" conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
''; '';
types = type.uniq types.string; type = types.uniq types.string;
}; };
}; };

View File

@ -8,7 +8,7 @@ rec {
enable = mkOption { enable = mkOption {
default = true; default = true;
types = types.bool; type = types.bool;
description = '' description = ''
If set to false, this unit will be a symlink to If set to false, this unit will be a symlink to
/dev/null. This is primarily useful to prevent specific /dev/null. This is primarily useful to prevent specific
@ -19,13 +19,13 @@ rec {
description = mkOption { description = mkOption {
default = ""; default = "";
types = types.uniq types.string; type = types.uniq types.string;
description = "Description of this unit used in systemd messages and progress indicators."; description = "Description of this unit used in systemd messages and progress indicators.";
}; };
requires = mkOption { requires = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
description = '' description = ''
Start the specified units when this unit is started, and stop Start the specified units when this unit is started, and stop
this unit when the specified units are stopped or fail. this unit when the specified units are stopped or fail.
@ -34,7 +34,7 @@ rec {
wants = mkOption { wants = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
description = '' description = ''
Start the specified units when this unit is started. Start the specified units when this unit is started.
''; '';
@ -42,7 +42,7 @@ rec {
after = mkOption { after = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
description = '' description = ''
If the specified units are started at the same time as If the specified units are started at the same time as
this unit, delay this unit until they have started. this unit, delay this unit until they have started.
@ -51,7 +51,7 @@ rec {
before = mkOption { before = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
description = '' description = ''
If the specified units are started at the same time as If the specified units are started at the same time as
this unit, delay them until this unit has started. this unit, delay them until this unit has started.
@ -60,7 +60,7 @@ rec {
bindsTo = mkOption { bindsTo = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
description = '' description = ''
Like requires, but in addition, if the specified units Like requires, but in addition, if the specified units
unexpectedly disappear, this unit will be stopped as well. unexpectedly disappear, this unit will be stopped as well.
@ -69,7 +69,7 @@ rec {
partOf = mkOption { partOf = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
description = '' description = ''
If the specified units are stopped or restarted, then this If the specified units are stopped or restarted, then this
unit is stopped or restarted as well. unit is stopped or restarted as well.
@ -78,7 +78,7 @@ rec {
conflicts = mkOption { conflicts = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
description = '' description = ''
If the specified units are started, then this unit is stopped If the specified units are started, then this unit is stopped
and vice versa. and vice versa.
@ -87,13 +87,13 @@ rec {
requiredBy = mkOption { requiredBy = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
description = "Units that require (i.e. depend on and need to go down with) this unit."; description = "Units that require (i.e. depend on and need to go down with) this unit.";
}; };
wantedBy = mkOption { wantedBy = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
description = "Units that want (i.e. depend on) this unit."; description = "Units that want (i.e. depend on) this unit.";
}; };
@ -250,7 +250,7 @@ rec {
listenStreams = mkOption { listenStreams = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
example = [ "0.0.0.0:993" "/run/my-socket" ]; example = [ "0.0.0.0:993" "/run/my-socket" ];
description = '' description = ''
For each item in this list, a <literal>ListenStream</literal> For each item in this list, a <literal>ListenStream</literal>

View File

@ -389,12 +389,12 @@ in
type = types.attrsOf types.optionSet; type = types.attrsOf types.optionSet;
options = { options = {
text = mkOption { text = mkOption {
types = types.uniq types.string; type = types.uniq types.string;
description = "Text of this systemd unit."; description = "Text of this systemd unit.";
}; };
enable = mkOption { enable = mkOption {
default = true; default = true;
types = types.bool; type = types.bool;
description = '' description = ''
If set to false, this unit will be a symlink to If set to false, this unit will be a symlink to
/dev/null. This is primarily useful to prevent specific /dev/null. This is primarily useful to prevent specific
@ -404,12 +404,12 @@ in
}; };
requiredBy = mkOption { requiredBy = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
description = "Units that require (i.e. depend on and need to go down with) this unit."; description = "Units that require (i.e. depend on and need to go down with) this unit.";
}; };
wantedBy = mkOption { wantedBy = mkOption {
default = []; default = [];
types = types.listOf types.string; type = types.listOf types.string;
description = "Units that want (i.e. depend on) this unit."; description = "Units that want (i.e. depend on) this unit.";
}; };
}; };

View File

@ -70,7 +70,7 @@ in
}; };
source = mkOption { source = mkOption {
types = types.path; type = types.path;
description = "Path of the source file."; description = "Path of the source file.";
}; };