summary refs log tree commit diff
diff options
context:
space:
mode:
authorYarny0 <41838844+Yarny0@users.noreply.github.com>2022-02-05 11:30:50 +0100
committerYarny0 <41838844+Yarny0@users.noreply.github.com>2022-02-05 11:32:22 +0100
commit21d6960e995b28e38e8095757eef117c5ce97294 (patch)
tree07e43f750431afe1aea1b7c450acfd50455e1b41
parent554d2d8aa25b6e583575459c297ec23750adb6cb (diff)
downloadnixpkgs-21d6960e995b28e38e8095757eef117c5ce97294.tar
nixpkgs-21d6960e995b28e38e8095757eef117c5ce97294.tar.gz
nixpkgs-21d6960e995b28e38e8095757eef117c5ce97294.tar.bz2
nixpkgs-21d6960e995b28e38e8095757eef117c5ce97294.tar.lz
nixpkgs-21d6960e995b28e38e8095757eef117c5ce97294.tar.xz
nixpkgs-21d6960e995b28e38e8095757eef117c5ce97294.tar.zst
nixpkgs-21d6960e995b28e38e8095757eef117c5ce97294.zip
nixos/hylafax: use new type `nonEmptyStr`
The module option type `nonEmptyStr` was introduced in commit

https://github.com/NixOS/nixpkgs/commit/a3c5f0cba8fa9c4d9782ef83757be6e4028f54b7

The hylafax module previously simply used
`addCheck str (s: s!="")` to prevent empty option strings,
but the new type is more thorough as
it also catches space-only strings.
-rw-r--r--nixos/modules/services/networking/hylafax/options.nix16
1 files changed, 7 insertions, 9 deletions
diff --git a/nixos/modules/services/networking/hylafax/options.nix b/nixos/modules/services/networking/hylafax/options.nix
index 8e59c68054d..8f621b61002 100644
--- a/nixos/modules/services/networking/hylafax/options.nix
+++ b/nixos/modules/services/networking/hylafax/options.nix
@@ -3,7 +3,7 @@
 let
 
   inherit (lib.options) literalExpression mkEnableOption mkOption;
-  inherit (lib.types) bool enum ints lines attrsOf nullOr path str submodule;
+  inherit (lib.types) bool enum ints lines attrsOf nonEmptyStr nullOr path str submodule;
   inherit (lib.modules) mkDefault mkIf mkMerge;
 
   commonDescr = ''
@@ -17,8 +17,6 @@ let
     configuration to yield an operational system.
   '';
 
-  str1 = lib.types.addCheck str (s: s!="");  # non-empty string
-
   configAttrType =
     # Options in HylaFAX configuration files can be
     # booleans, strings, integers, or list thereof
@@ -37,7 +35,7 @@ let
   modemConfigOptions = { name, config, ... }: {
     options = {
       name = mkOption {
-        type = str1;
+        type = nonEmptyStr;
         example = "ttyS1";
         description = ''
           Name of modem device,
@@ -45,7 +43,7 @@ let
         '';
       };
       type = mkOption {
-        type = str1;
+        type = nonEmptyStr;
         example = "cirrus";
         description = ''
           Name of modem configuration file,
@@ -135,14 +133,14 @@ in
     };
 
     countryCode = mkOption {
-      type = nullOr str1;
+      type = nullOr nonEmptyStr;
       default = null;
       example = "49";
       description = "Country code for server and all modems.";
     };
 
     areaCode = mkOption {
-      type = nullOr str1;
+      type = nullOr nonEmptyStr;
       default = null;
       example = "30";
       description = "Area code for server and all modems.";
@@ -279,7 +277,7 @@ in
       each time the spooling area is initialized.
     '';
     faxcron.enable.frequency = mkOption {
-      type = nullOr str1;
+      type = nullOr nonEmptyStr;
       default = null;
       example = "daily";
       description = ''
@@ -319,7 +317,7 @@ in
       each time the spooling area is initialized.
     '';
     faxqclean.enable.frequency = mkOption {
-      type = nullOr str1;
+      type = nullOr nonEmptyStr;
       default = null;
       example = "daily";
       description = ''