nixos/tsm-{client,backup}: use new type nonEmptyStr

The module option type `nonEmptyStr` was introduced in commit

a3c5f0cba8

The tsm modules previously simply used
`strMatching ".+"` to prevent empty option strings,
but the new type is more thorough as
it also catches space-only strings.
This commit is contained in:
Yarny0 2021-12-05 13:52:06 +01:00
parent c5effcaaea
commit c2192ed77a
2 changed files with 7 additions and 7 deletions

View file

@ -7,7 +7,7 @@ let
inherit (lib.modules) mkDefault mkIf; inherit (lib.modules) mkDefault mkIf;
inherit (lib.options) literalExpression mkEnableOption mkOption; inherit (lib.options) literalExpression mkEnableOption mkOption;
inherit (lib.strings) concatStringsSep optionalString toLower; inherit (lib.strings) concatStringsSep optionalString toLower;
inherit (lib.types) addCheck attrsOf lines nullOr package path port str strMatching submodule; inherit (lib.types) addCheck attrsOf lines nonEmptyStr nullOr package path port str strMatching submodule;
# Checks if given list of strings contains unique # Checks if given list of strings contains unique
# elements when compared without considering case. # elements when compared without considering case.
@ -35,7 +35,7 @@ let
''; '';
}; };
options.server = mkOption { options.server = mkOption {
type = strMatching ".+"; type = nonEmptyStr;
example = "tsmserver.company.com"; example = "tsmserver.company.com";
description = '' description = ''
Host/domain name or IP address of the IBM TSM server. Host/domain name or IP address of the IBM TSM server.
@ -56,7 +56,7 @@ let
''; '';
}; };
options.node = mkOption { options.node = mkOption {
type = strMatching ".+"; type = nonEmptyStr;
example = "MY-TSM-NODE"; example = "MY-TSM-NODE";
description = '' description = ''
Target node name on the IBM TSM server. Target node name on the IBM TSM server.

View file

@ -5,7 +5,7 @@ let
inherit (lib.attrsets) hasAttr; inherit (lib.attrsets) hasAttr;
inherit (lib.modules) mkDefault mkIf; inherit (lib.modules) mkDefault mkIf;
inherit (lib.options) mkEnableOption mkOption; inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) nullOr strMatching; inherit (lib.types) nonEmptyStr nullOr;
options.services.tsmBackup = { options.services.tsmBackup = {
enable = mkEnableOption '' enable = mkEnableOption ''
@ -15,7 +15,7 @@ let
<option>programs.tsmClient.enable</option> <option>programs.tsmClient.enable</option>
''; '';
command = mkOption { command = mkOption {
type = strMatching ".+"; type = nonEmptyStr;
default = "backup"; default = "backup";
example = "incr"; example = "incr";
description = '' description = ''
@ -24,7 +24,7 @@ let
''; '';
}; };
servername = mkOption { servername = mkOption {
type = strMatching ".+"; type = nonEmptyStr;
example = "mainTsmServer"; example = "mainTsmServer";
description = '' description = ''
Create a systemd system service Create a systemd system service
@ -41,7 +41,7 @@ let
''; '';
}; };
autoTime = mkOption { autoTime = mkOption {
type = nullOr (strMatching ".+"); type = nullOr nonEmptyStr;
default = null; default = null;
example = "12:00"; example = "12:00";
description = '' description = ''