nixos/hylafax: use lib.types.ints.positive

I haven't realized earlier that there is
already an option type for postive integers.
This commit is contained in:
Yarny0 2021-05-08 20:44:32 +02:00
parent b5464b008f
commit 449647daf5

View file

@ -3,7 +3,7 @@
let
inherit (lib.options) literalExample mkEnableOption mkOption;
inherit (lib.types) bool enum int lines attrsOf nullOr path str submodule;
inherit (lib.types) bool enum ints lines attrsOf nullOr path str submodule;
inherit (lib.modules) mkDefault mkIf mkMerge;
commonDescr = ''
@ -18,7 +18,6 @@ let
'';
str1 = lib.types.addCheck str (s: s!=""); # non-empty string
int1 = lib.types.addCheck int (i: i>0); # positive integer
configAttrType =
# Options in HylaFAX configuration files can be
@ -27,7 +26,7 @@ let
# This type definition resolves all
# those types into a list of strings.
let
inherit (lib.types) attrsOf coercedTo listOf;
inherit (lib.types) attrsOf coercedTo int listOf;
innerType = coercedTo bool (x: if x then "Yes" else "No")
(coercedTo int (toString) str);
in
@ -290,7 +289,7 @@ in
'';
};
faxcron.infoDays = mkOption {
type = int1;
type = ints.positive;
default = 30;
description = ''
Set the expiration time for data in the
@ -298,7 +297,7 @@ in
'';
};
faxcron.logDays = mkOption {
type = int1;
type = ints.positive;
default = 30;
description = ''
Set the expiration time for
@ -306,7 +305,7 @@ in
'';
};
faxcron.rcvDays = mkOption {
type = int1;
type = ints.positive;
default = 7;
description = ''
Set the expiration time for files in
@ -343,7 +342,7 @@ in
'';
};
faxqclean.doneqMinutes = mkOption {
type = int1;
type = ints.positive;
default = 15;
example = literalExample "24*60";
description = ''
@ -353,7 +352,7 @@ in
'';
};
faxqclean.docqMinutes = mkOption {
type = int1;
type = ints.positive;
default = 60;
example = literalExample "24*60";
description = ''