Merge pull request #3864 from nbp/useless-submodules

Remove useless use of undocumented submodules.
This commit is contained in:
Nicolas B. Pierron 2014-08-30 18:21:17 +02:00
commit a5d6219897
4 changed files with 236 additions and 267 deletions

View File

@ -277,13 +277,14 @@ rec {
fixupOptionType = loc: opt: fixupOptionType = loc: opt:
let let
options' = opt.options or options' = opt.options or
(throw "Option `${showOption loc'}' has type optionSet but has no option attribute."); (throw "Option `${showOption loc'}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}.");
coerce = x: coerce = x:
if isFunction x then x if isFunction x then x
else { config, ... }: { options = x; }; else { config, ... }: { options = x; };
options = map coerce (flatten options'); options = map coerce (flatten options');
f = tp: f = tp:
if tp.name == "option set" then types.submodule options if tp.name == "option set" || tp.name == "submodule" then
throw "The option ${showOption loc} uses submodules without a wrapping type, in ${showFiles opt.declarations}."
else if tp.name == "attribute set of option sets" then types.attrsOf (types.submodule options) else if tp.name == "attribute set of option sets" then types.attrsOf (types.submodule options)
else if tp.name == "list or attribute set of option sets" then types.loaOf (types.submodule options) else if tp.name == "list or attribute set of option sets" then types.loaOf (types.submodule options)
else if tp.name == "list of option sets" then types.listOf (types.submodule options) else if tp.name == "list of option sets" then types.listOf (types.submodule options)

View File

@ -456,156 +456,131 @@ in
}; };
ratelimit = mkOption { ratelimit = {
type = types.submodule ( enable = mkOption {
{ options, ... }: type = types.bool;
{ options = { default = false;
description = ''
enable = mkOption { Enable ratelimit capabilities.
type = types.bool; '';
default = false; };
description = ''
Enable ratelimit capabilities. size = mkOption {
''; type = types.int;
}; default = 1000000;
description = ''
size = mkOption { Size of the hashtable. More buckets use more memory but lower
type = types.int; the chance of hash hash collisions.
default = 1000000; '';
description = '' };
Size of the hashtable. More buckets use more memory but lower
the chance of hash hash collisions. ratelimit = mkOption {
''; type = types.int;
}; default = 200;
description = ''
ratelimit = mkOption { Max qps allowed from any query source.
type = types.int; 0 means unlimited. With an verbosity of 2 blocked and
default = 200; unblocked subnets will be logged.
description = '' '';
Max qps allowed from any query source. };
0 means unlimited. With an verbosity of 2 blocked and
unblocked subnets will be logged. whitelistRatelimit = mkOption {
''; type = types.int;
}; default = 2000;
description = ''
whitelistRatelimit = mkOption { Max qps allowed from whitelisted sources.
type = types.int; 0 means unlimited. Set the rrl-whitelist option for specific
default = 2000; queries to apply this limit instead of the default to them.
description = '' '';
Max qps allowed from whitelisted sources. };
0 means unlimited. Set the rrl-whitelist option for specific
queries to apply this limit instead of the default to them. slip = mkOption {
''; type = types.nullOr types.int;
}; default = null;
description = ''
slip = mkOption { Number of packets that get discarded before replying a SLIP response.
type = types.nullOr types.int; 0 disables SLIP responses. 1 will make every response a SLIP response.
default = null; '';
description = '' };
Number of packets that get discarded before replying a SLIP response.
0 disables SLIP responses. 1 will make every response a SLIP response. ipv4PrefixLength = mkOption {
''; type = types.nullOr types.int;
}; default = null;
description = ''
ipv4PrefixLength = mkOption { IPv4 prefix length. Addresses are grouped by netblock.
type = types.nullOr types.int; '';
default = null; };
description = ''
IPv4 prefix length. Addresses are grouped by netblock. ipv6PrefixLength = mkOption {
''; type = types.nullOr types.int;
}; default = null;
description = ''
ipv6PrefixLength = mkOption { IPv6 prefix length. Addresses are grouped by netblock.
type = types.nullOr types.int; '';
default = null;
description = ''
IPv6 prefix length. Addresses are grouped by netblock.
'';
};
};
});
default = {
}; };
example = {};
description = ''
'';
}; };
remoteControl = mkOption { remoteControl = {
type = types.submodule ( enable = mkOption {
{ config, options, ... }: type = types.bool;
{ options = { default = false;
description = ''
enable = mkOption { Wheter to enable remote control via nsd-control(8).
type = types.bool; '';
default = false; };
description = ''
Wheter to enable remote control via nsd-control(8). interfaces = mkOption {
''; type = types.listOf types.str;
}; default = [ "127.0.0.1" "::1" ];
description = ''
interfaces = mkOption { Which interfaces NSD should bind to for remote control.
type = types.listOf types.str; '';
default = [ "127.0.0.1" "::1" ]; };
description = ''
Which interfaces NSD should bind to for remote control. port = mkOption {
''; type = types.int;
}; default = 8952;
description = ''
port = mkOption { Port number for remote control operations (uses TLS over TCP).
type = types.int; '';
default = 8952; };
description = ''
Port number for remote control operations (uses TLS over TCP). serverKeyFile = mkOption {
''; type = types.path;
}; default = "/etc/nsd/nsd_server.key";
description = ''
serverKeyFile = mkOption { Path to the server private key, which is used by the server
type = types.path; but not by nsd-control. This file is generated by nsd-control-setup.
default = "/etc/nsd/nsd_server.key"; '';
description = '' };
Path to the server private key, which is used by the server
but not by nsd-control. This file is generated by nsd-control-setup. serverCertFile = mkOption {
''; type = types.path;
}; default = "/etc/nsd/nsd_server.pem";
description = ''
serverCertFile = mkOption { Path to the server self signed certificate, which is used by the server
type = types.path; but and by nsd-control. This file is generated by nsd-control-setup.
default = "/etc/nsd/nsd_server.pem"; '';
description = '' };
Path to the server self signed certificate, which is used by the server
but and by nsd-control. This file is generated by nsd-control-setup. controlKeyFile = mkOption {
''; type = types.path;
}; default = "/etc/nsd/nsd_control.key";
description = ''
controlKeyFile = mkOption { Path to the client private key, which is used by nsd-control
type = types.path; but not by the server. This file is generated by nsd-control-setup.
default = "/etc/nsd/nsd_control.key"; '';
description = '' };
Path to the client private key, which is used by nsd-control
but not by the server. This file is generated by nsd-control-setup. controlCertFile = mkOption {
''; type = types.path;
}; default = "/etc/nsd/nsd_control.pem";
description = ''
controlCertFile = mkOption { Path to the client certificate signed with the server certificate.
type = types.path; This file is used by nsd-control and generated by nsd-control-setup.
default = "/etc/nsd/nsd_control.pem"; '';
description = ''
Path to the client certificate signed with the server certificate.
This file is used by nsd-control and generated by nsd-control-setup.
'';
};
};
});
default = {
}; };
example = {};
description = ''
'';
}; };

View File

@ -25,85 +25,6 @@ let
paths = cfg.modulePackages; paths = cfg.modulePackages;
}; };
confOptions = { ... }: {
options = {
modules = mkOption {
type = types.listOf types.string;
default = [ "partyline" "webadmin" "adminlog" "log" ];
example = [ "partyline" "webadmin" "adminlog" "log" ];
description = ''
A list of modules to include in the `znc.conf` file.
'';
};
userModules = mkOption {
type = types.listOf types.string;
default = [ ];
example = [ "fish" "push" ];
description = ''
A list of user modules to include in the `znc.conf` file.
'';
};
userName = mkOption {
default = defaultUserName;
example = "johntron";
type = types.string;
description = ''
The user name to use when generating the `znc.conf` file.
This is the user name used by the user logging into the ZNC web admin.
'';
};
nick = mkOption {
default = "znc-user";
example = "john";
type = types.string;
description = ''
The IRC nick to use when generating the `znc.conf` file.
'';
};
passBlock = mkOption {
default = defaultPassBlock;
example = "Must be the block generated by the `znc --makepass` command.";
type = types.string;
description = ''
The pass block to use when generating the `znc.conf` file.
This is the password used by the user logging into the ZNC web admin.
This is the block generated by the `znc --makepass` command.
!!! If not specified, please change this after starting the service. !!!
'';
};
port = mkOption {
default = 5000;
example = 5000;
type = types.int;
description = ''
Specifies the port on which to listen.
'';
};
useSSL = mkOption {
default = true;
example = true;
type = types.bool;
description = ''
Indicates whether the ZNC server should use SSL when listening on the specified port.
'';
};
extraZncConf = mkOption {
default = "";
type = types.lines;
description = ''
Extra config to `znc.conf` file
'';
};
};
};
# Keep znc.conf in nix store, then symlink or copy into `dataDir`, depending on `mutable`. # Keep znc.conf in nix store, then symlink or copy into `dataDir`, depending on `mutable`.
mkZncConf = confOpts: '' mkZncConf = confOpts: ''
// Also check http://en.znc.in/wiki/Configuration // Also check http://en.znc.in/wiki/Configuration
@ -211,18 +132,91 @@ in
''; '';
}; };
confOptions = mkOption { /* TODO: add to the documentation of the current module:
default = {};
example = { Values to use when creating a `znc.conf` file.
modules = [ "log" ];
userName = "john"; confOptions = {
nick = "johntron"; modules = [ "log" ];
userName = "john";
nick = "johntron";
};
*/
confOptions = {
modules = mkOption {
type = types.listOf types.string;
default = [ "partyline" "webadmin" "adminlog" "log" ];
example = [ "partyline" "webadmin" "adminlog" "log" ];
description = ''
A list of modules to include in the `znc.conf` file.
'';
};
userModules = mkOption {
type = types.listOf types.string;
default = [ ];
example = [ "fish" "push" ];
description = ''
A list of user modules to include in the `znc.conf` file.
'';
};
userName = mkOption {
default = defaultUserName;
example = "johntron";
type = types.string;
description = ''
The user name to use when generating the `znc.conf` file.
This is the user name used by the user logging into the ZNC web admin.
'';
};
nick = mkOption {
default = "znc-user";
example = "john";
type = types.string;
description = ''
The IRC nick to use when generating the `znc.conf` file.
'';
};
passBlock = mkOption {
default = defaultPassBlock;
example = "Must be the block generated by the `znc --makepass` command.";
type = types.string;
description = ''
The pass block to use when generating the `znc.conf` file.
This is the password used by the user logging into the ZNC web admin.
This is the block generated by the `znc --makepass` command.
!!! If not specified, please change this after starting the service. !!!
'';
};
port = mkOption {
default = 5000;
example = 5000;
type = types.int;
description = ''
Specifies the port on which to listen.
'';
};
useSSL = mkOption {
default = true;
example = true;
type = types.bool;
description = ''
Indicates whether the ZNC server should use SSL when listening on the specified port.
'';
};
extraZncConf = mkOption {
default = "";
type = types.lines;
description = ''
Extra config to `znc.conf` file
'';
}; };
type = types.optionSet;
description = ''
Values to use when creating a `znc.conf` file.
'';
options = confOptions;
}; };
modulePackages = mkOption { modulePackages = mkOption {

View File

@ -342,40 +342,39 @@ in
description = "Path where the ramfs used to update the LUKS key will be mounted in stage-1"; description = "Path where the ramfs used to update the LUKS key will be mounted in stage-1";
}; };
storage = mkOption { /* TODO: Add to the documentation of the current module:
type = types.optionSet;
description = "Options related to the storing the salt";
options = { Options related to the storing the salt.
device = mkOption { */
default = "/dev/sda1"; storage = {
type = types.path; device = mkOption {
description = '' default = "/dev/sda1";
An unencrypted device that will temporarily be mounted in stage-1. type = types.path;
Must contain the current salt to create the challenge for this LUKS device. description = ''
''; An unencrypted device that will temporarily be mounted in stage-1.
}; Must contain the current salt to create the challenge for this LUKS device.
'';
};
fsType = mkOption { fsType = mkOption {
default = "vfat"; default = "vfat";
type = types.string; type = types.string;
description = "The filesystem of the unencrypted device"; description = "The filesystem of the unencrypted device";
}; };
mountPoint = mkOption { mountPoint = mkOption {
default = "/crypt-storage"; default = "/crypt-storage";
type = types.string; type = types.string;
description = "Path where the unencrypted device will be mounted in stage-1"; description = "Path where the unencrypted device will be mounted in stage-1";
}; };
path = mkOption { path = mkOption {
default = "/crypt-storage/default"; default = "/crypt-storage/default";
type = types.string; type = types.string;
description = '' description = ''
Absolute path of the salt on the unencrypted device with Absolute path of the salt on the unencrypted device with
that device's root directory as "/". that device's root directory as "/".
''; '';
};
}; };
}; };
}; };