nixos/znc-service: don't use types.string (it's deprecated)

Apart from s/types.string/types.str/ (or types.lines where appropriate):

* port is changed from string to int.

* extraFlags is changed from types.string (with unfortunate merge
  semantics) into a list of strings. A list of strings merge better:
  one space is added between elements.
This commit is contained in:
Bjørn Forsman 2014-07-13 20:27:19 +02:00
parent a9858101bc
commit 3a4498ab07

View File

@ -23,7 +23,7 @@ let
confOptions = { ... }: { confOptions = { ... }: {
options = { options = {
modules = mkOption { modules = mkOption {
type = types.listOf types.string; type = types.listOf types.str;
default = [ "partyline" "webadmin" "adminlog" "log" ]; default = [ "partyline" "webadmin" "adminlog" "log" ];
example = [ "partyline" "webadmin" "adminlog" "log" ]; example = [ "partyline" "webadmin" "adminlog" "log" ];
description = '' description = ''
@ -34,7 +34,7 @@ let
userName = mkOption { userName = mkOption {
default = defaultUserName; default = defaultUserName;
example = "johntron"; example = "johntron";
type = types.string; type = types.str;
description = '' description = ''
The user name to use when generating the `znc.conf` file. 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. This is the user name used by the user logging into the ZNC web admin.
@ -44,7 +44,7 @@ let
nick = mkOption { nick = mkOption {
default = "znc-user"; default = "znc-user";
example = "john"; example = "john";
type = types.string; type = types.str;
description = '' description = ''
The IRC nick to use when generating the `znc.conf` file. The IRC nick to use when generating the `znc.conf` file.
''; '';
@ -53,7 +53,7 @@ let
passBlock = mkOption { passBlock = mkOption {
default = defaultPassBlock; default = defaultPassBlock;
example = "Must be the block generated by the `znc --makepass` command."; example = "Must be the block generated by the `znc --makepass` command.";
type = types.string; type = types.str;
description = '' description = ''
The pass block to use when generating the `znc.conf` file. 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 password used by the user logging into the ZNC web admin.
@ -63,9 +63,9 @@ let
}; };
port = mkOption { port = mkOption {
default = "5000"; default = 5000;
example = "5000"; example = 5000;
type = types.string; type = types.int;
description = '' description = ''
Specifies the port on which to listen. Specifies the port on which to listen.
''; '';
@ -104,7 +104,7 @@ let
AllowWeb = true AllowWeb = true
IPv4 = true IPv4 = true
IPv6 = false IPv6 = false
Port = ${if confOpts.useSSL then "+" else ""}${confOpts.port} Port = ${if confOpts.useSSL then "+" else ""}${toString confOpts.port}
SSL = ${if confOpts.useSSL then "true" else "false"} SSL = ${if confOpts.useSSL then "true" else "false"}
</Listener> </Listener>
@ -160,7 +160,7 @@ in
user = mkOption { user = mkOption {
default = "znc"; default = "znc";
example = "john"; example = "john";
type = types.string; type = types.str;
description = '' description = ''
The name of an existing user account to use to own the ZNC server process. The name of an existing user account to use to own the ZNC server process.
If not specified, a default user will be created to own the process. If not specified, a default user will be created to own the process.
@ -170,7 +170,7 @@ in
dataDir = mkOption { dataDir = mkOption {
default = "/home/${cfg.user}/.znc"; default = "/home/${cfg.user}/.znc";
example = "/home/john/.znc"; example = "/home/john/.znc";
type = types.string; type = types.path;
description = '' description = ''
The data directory. Used for configuration files and modules. The data directory. Used for configuration files and modules.
''; '';
@ -179,7 +179,7 @@ in
zncConf = mkOption { zncConf = mkOption {
default = ""; default = "";
example = "See: http://wiki.znc.in/Configuration"; example = "See: http://wiki.znc.in/Configuration";
type = types.string; type = types.lines;
description = '' description = ''
The contents of the `znc.conf` file to use when creating it. The contents of the `znc.conf` file to use when creating it.
If specified, `confOptions` will be ignored, and this value, as-is, will be used. If specified, `confOptions` will be ignored, and this value, as-is, will be used.
@ -218,9 +218,9 @@ in
}; };
extraFlags = mkOption { extraFlags = mkOption {
default = ""; default = [ ];
example = "--debug"; example = [ "--debug" ];
type = types.string; type = types.listOf types.str;
description = '' description = ''
Extra flags to use when executing znc command. Extra flags to use when executing znc command.
''; '';
@ -272,7 +272,7 @@ in
${pkgs.znc}/bin/znc --makepem ${pkgs.znc}/bin/znc --makepem
fi fi
''; '';
script = "${pkgs.znc}/bin/znc --foreground --datadir ${cfg.dataDir} ${cfg.extraFlags}"; script = "${pkgs.znc}/bin/znc --foreground --datadir ${cfg.dataDir} ${toString cfg.extraFlags}";
}; };
users.extraUsers = optional (cfg.user == defaultUser) users.extraUsers = optional (cfg.user == defaultUser)