From 34fe1083bd9c47ebdef5b63521146a8cf788229a Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:18:00 +0200 Subject: [PATCH 01/17] nixos/journalwatch: use more accurate int types --- nixos/modules/services/logging/journalwatch.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/logging/journalwatch.nix b/nixos/modules/services/logging/journalwatch.nix index 19ec7f76af8c..7ec2144230ed 100644 --- a/nixos/modules/services/logging/journalwatch.nix +++ b/nixos/modules/services/logging/journalwatch.nix @@ -72,7 +72,7 @@ in package = lib.mkPackageOption pkgs "journalwatch" { }; priority = lib.mkOption { - type = lib.types.int; + type = lib.types.ints.between 0 7; default = 6; description = '' Lowest priority of message to be considered. From 32a008369e779c0e17b8668001565e2f96fd40b4 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:22:25 +0200 Subject: [PATCH 02/17] various: prefer `ints.between` over `enum` for int ranges --- nixos/modules/services/monitoring/nezha-agent.nix | 7 +------ nixos/modules/services/security/cfssl.nix | 9 +-------- nixos/modules/services/security/opensnitch.nix | 8 +------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/nixos/modules/services/monitoring/nezha-agent.nix b/nixos/modules/services/monitoring/nezha-agent.nix index 87ecbfdde710..e9161defe80b 100644 --- a/nixos/modules/services/monitoring/nezha-agent.nix +++ b/nixos/modules/services/monitoring/nezha-agent.nix @@ -98,12 +98,7 @@ in ''; }; report_delay = lib.mkOption { - type = lib.types.enum [ - 1 - 2 - 3 - 4 - ]; + type = lib.types.ints.between 1 4; default = 3; description = '' The interval between system status reportings. diff --git a/nixos/modules/services/security/cfssl.nix b/nixos/modules/services/security/cfssl.nix index 514442dbe437..329002417a25 100644 --- a/nixos/modules/services/security/cfssl.nix +++ b/nixos/modules/services/security/cfssl.nix @@ -154,14 +154,7 @@ in logLevel = lib.mkOption { default = 1; - type = lib.types.enum [ - 0 - 1 - 2 - 3 - 4 - 5 - ]; + type = lib.types.ints.between 0 5; description = "Log level (0 = DEBUG, 5 = FATAL)."; }; diff --git a/nixos/modules/services/security/opensnitch.nix b/nixos/modules/services/security/opensnitch.nix index 26c015a8107e..12643b20bd6a 100644 --- a/nixos/modules/services/security/opensnitch.nix +++ b/nixos/modules/services/security/opensnitch.nix @@ -108,13 +108,7 @@ in }; LogLevel = lib.mkOption { - type = lib.types.enum [ - 0 - 1 - 2 - 3 - 4 - ]; + type = lib.types.ints.between 0 4; description = '' Default log level from 0 to 4 (debug, info, important, warning, error). From 27a6fc2af587951a8cdc2e10a89babd3817c895e Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:28:09 +0200 Subject: [PATCH 03/17] nixos/apache-httpd: use more accurate int types --- nixos/modules/services/web-servers/apache-httpd/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 07d4ad7fccfa..28d64a2e2bee 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -704,14 +704,14 @@ in }; maxClients = mkOption { - type = types.int; + type = types.ints.positive; default = 150; example = 8; description = "Maximum number of httpd processes (prefork)"; }; maxRequestsPerChild = mkOption { - type = types.int; + type = types.ints.unsigned; default = 0; example = 500; description = '' From 5bd07053b4b87ba826cff118cdf460363f728cac Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:32:39 +0200 Subject: [PATCH 04/17] nixos/gotenberg: use more accurate int types --- nixos/modules/services/misc/gotenberg.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/misc/gotenberg.nix b/nixos/modules/services/misc/gotenberg.nix index e9a6388b970b..542aa342e5d6 100644 --- a/nixos/modules/services/misc/gotenberg.nix +++ b/nixos/modules/services/misc/gotenberg.nix @@ -107,7 +107,7 @@ in package = mkPackageOption pkgs "chromium" { }; maxQueueSize = mkOption { - type = types.int; + type = types.ints.unsigned; default = 0; description = "Maximum queue size for chromium-based conversions. Setting to 0 disables the limit."; }; @@ -143,7 +143,7 @@ in description = "Deny accepting URLs from these domains in the `downloadFrom` API field. Accepts a regular expression."; }; maxRetries = mkOption { - type = types.int; + type = types.ints.unsigned; default = 4; description = "The maximum amount of times to retry downloading a file specified with `downloadFrom`."; }; @@ -158,13 +158,13 @@ in package = mkPackageOption pkgs "libreoffice" { }; restartAfter = mkOption { - type = types.int; + type = types.ints.unsigned; default = 10; description = "Restart LibreOffice after this many conversions. Setting to 0 disables this feature."; }; maxQueueSize = mkOption { - type = types.int; + type = types.ints.unsigned; default = 0; description = "Maximum queue size for LibreOffice-based conversions. Setting to 0 disables the limit."; }; From 776e13baaf55c41c09fe62ac166d995f9571f5d6 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:34:01 +0200 Subject: [PATCH 05/17] nixos/stargazer: use more accurate int types --- nixos/modules/services/web-servers/stargazer.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/web-servers/stargazer.nix b/nixos/modules/services/web-servers/stargazer.nix index c29f0107cd0e..4af08aeba0c1 100644 --- a/nixos/modules/services/web-servers/stargazer.nix +++ b/nixos/modules/services/web-servers/stargazer.nix @@ -74,7 +74,7 @@ in }; requestTimeout = lib.mkOption { - type = lib.types.int; + type = lib.types.ints.unsigned; default = 5; description = '' Number of seconds to wait for the client to send a complete @@ -83,7 +83,7 @@ in }; responseTimeout = lib.mkOption { - type = lib.types.int; + type = lib.types.ints.unsigned; default = 0; description = '' Number of seconds to wait for the client to send a complete From bda8f779742f33ada3e4184af99eb88de478eadd Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:35:37 +0200 Subject: [PATCH 06/17] nixos/rshim: use more accurate int types --- nixos/modules/services/misc/rshim.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/rshim.nix b/nixos/modules/services/misc/rshim.nix index 49296f0e2f05..37bcb40e16e7 100644 --- a/nixos/modules/services/misc/rshim.nix +++ b/nixos/modules/services/misc/rshim.nix @@ -61,7 +61,7 @@ in }; log-level = lib.mkOption { - type = lib.types.int; + type = lib.types.ints.between 0 4; description = '' Specify the log level (0:none, 1:error, 2:warning, 3:notice, 4:debug). ''; From 54f5ec23ece9a3f4a6e554838e3378eb5754e00c Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:38:10 +0200 Subject: [PATCH 07/17] nixos/hostapd: use more accurate int types --- nixos/modules/services/networking/hostapd.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/networking/hostapd.nix b/nixos/modules/services/networking/hostapd.nix index 5fa3cadb9a7e..a9c686763ca9 100644 --- a/nixos/modules/services/networking/hostapd.nix +++ b/nixos/modules/services/networking/hostapd.nix @@ -274,7 +274,7 @@ in channel = mkOption { default = 0; example = 11; - type = types.int; + type = types.ints.positive; description = '' The channel to operate on. Use 0 to enable ACS (Automatic Channel Selection). Beware that not every device supports ACS in which case {command}`hostapd` @@ -571,7 +571,7 @@ in options = { logLevel = mkOption { default = 2; - type = types.int; + type = types.ints.between 0 4; description = '' Levels (minimum value for logged events): 0 = verbose debugging @@ -957,7 +957,7 @@ in vlanid = mkOption { default = null; example = 1; - type = types.nullOr types.int; + type = types.nullOr types.ints.unsigned; description = "If this attribute is given, all clients using this entry will get tagged with the given VLAN ID."; }; From 016298079e1d05bdee8a0c64db659e0fdd67e227 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:44:29 +0200 Subject: [PATCH 08/17] nixos/resilio: use more accurate int types --- nixos/modules/services/networking/resilio.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/networking/resilio.nix b/nixos/modules/services/networking/resilio.nix index 25ad4b13daf2..2b72d7cbffc0 100644 --- a/nixos/modules/services/networking/resilio.nix +++ b/nixos/modules/services/networking/resilio.nix @@ -113,7 +113,7 @@ in }; listeningPort = mkOption { - type = types.int; + type = types.port; default = 0; example = 44444; description = '' @@ -139,7 +139,7 @@ in }; downloadLimit = mkOption { - type = types.int; + type = types.ints.unsigned; default = 0; example = 1024; description = '' @@ -148,7 +148,7 @@ in }; uploadLimit = mkOption { - type = types.int; + type = types.ints.unsigned; default = 0; example = 1024; description = '' @@ -166,7 +166,7 @@ in }; httpListenPort = mkOption { - type = types.int; + type = types.port; default = 9000; description = '' HTTP port to bind on. From adccbd9442f81c6bee65ffd00b1ce250bbdc7898 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:49:57 +0200 Subject: [PATCH 09/17] nixos/cpuminer-cryptonight: use more accurate int types --- nixos/modules/services/misc/cpuminer-cryptonight.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/cpuminer-cryptonight.nix b/nixos/modules/services/misc/cpuminer-cryptonight.nix index adaee2bbb215..a06077497e22 100644 --- a/nixos/modules/services/misc/cpuminer-cryptonight.nix +++ b/nixos/modules/services/misc/cpuminer-cryptonight.nix @@ -43,7 +43,7 @@ in description = "Password for mining server"; }; threads = lib.mkOption { - type = lib.types.int; + type = lib.types.ints.unsigned; default = 0; description = "Number of miner threads, defaults to available processors"; }; From 33fb2c08bfc14a826137978ef456a8e49faca44b Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:52:44 +0200 Subject: [PATCH 10/17] nixos/radvd: use more accurate int types --- nixos/modules/services/networking/radvd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/radvd.nix b/nixos/modules/services/networking/radvd.nix index 17bc051fca20..19a0b293095d 100644 --- a/nixos/modules/services/networking/radvd.nix +++ b/nixos/modules/services/networking/radvd.nix @@ -39,7 +39,7 @@ in package = mkPackageOption pkgs "radvd" { }; debugLevel = mkOption { - type = types.int; + type = types.ints.between 0 5; default = 0; example = 5; description = '' From 2a3f551195f44adf10e5845a0311aaf80783677b Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:56:48 +0200 Subject: [PATCH 11/17] nixos/icecream: use more accurate int types --- nixos/modules/services/networking/icecream/daemon.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/icecream/daemon.nix b/nixos/modules/services/networking/icecream/daemon.nix index 789ff377bbaf..baf63539254f 100644 --- a/nixos/modules/services/networking/icecream/daemon.nix +++ b/nixos/modules/services/networking/icecream/daemon.nix @@ -79,7 +79,7 @@ in }; nice = mkOption { - type = types.int; + type = types.ints.between (-20) 19; default = 5; description = '' The level of niceness to use. From 8c0bf2ac68b6ab8614d8718dbad70630b6ed0151 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:57:21 +0200 Subject: [PATCH 12/17] nixos/freenet: use more accurate int types --- nixos/modules/services/networking/freenet.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/freenet.nix b/nixos/modules/services/networking/freenet.nix index a0c67796377b..c95eb5d271af 100644 --- a/nixos/modules/services/networking/freenet.nix +++ b/nixos/modules/services/networking/freenet.nix @@ -15,7 +15,7 @@ in enable = lib.mkEnableOption "Freenet daemon"; nice = lib.mkOption { - type = lib.types.int; + type = lib.types.ints.between (-20) 19; default = 10; description = "Set the nice level for the Freenet daemon"; }; From f15acca831a89043948457a6bb156a9e9dbed6dc Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 15:58:24 +0200 Subject: [PATCH 13/17] nixos/distccd: use more accurate int types --- nixos/modules/services/development/distccd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/development/distccd.nix b/nixos/modules/services/development/distccd.nix index 46d09911e2b7..29ea8767b283 100644 --- a/nixos/modules/services/development/distccd.nix +++ b/nixos/modules/services/development/distccd.nix @@ -65,7 +65,7 @@ in }; nice = lib.mkOption { - type = lib.types.nullOr lib.types.int; + type = lib.types.nullOr (lib.types.ints.between (-20) 19); default = null; description = '' Niceness of the compilation tasks. From 2b075e121e2426d2abfdf8163d282e5b640c9e84 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 16:04:31 +0200 Subject: [PATCH 14/17] nixos/cachix-watch-store: use more accurate int types --- nixos/modules/services/system/cachix-watch-store.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/system/cachix-watch-store.nix b/nixos/modules/services/system/cachix-watch-store.nix index 0df74b927afa..b30a57cd4926 100644 --- a/nixos/modules/services/system/cachix-watch-store.nix +++ b/nixos/modules/services/system/cachix-watch-store.nix @@ -36,13 +36,13 @@ in }; compressionLevel = lib.mkOption { - type = lib.types.nullOr lib.types.int; + type = lib.types.nullOr (lib.types.ints.between 0 16); description = "The compression level for ZSTD compression (between 0 and 16)"; default = null; }; jobs = lib.mkOption { - type = lib.types.nullOr lib.types.int; + type = lib.types.nullOr lib.types.ints.positive; description = "Number of threads used for pushing store paths"; default = null; }; From b32466599d3edd82497eb95d9e3853934d121555 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 16:07:33 +0200 Subject: [PATCH 15/17] nixos/redshift: use more accurate int types --- nixos/modules/services/x11/redshift.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/x11/redshift.nix b/nixos/modules/services/x11/redshift.nix index 661053c20016..0ebde5bf642b 100644 --- a/nixos/modules/services/x11/redshift.nix +++ b/nixos/modules/services/x11/redshift.nix @@ -51,7 +51,7 @@ in temperature = { day = mkOption { - type = types.int; + type = types.ints.between 1000 25000; default = 5500; description = '' Colour temperature to use during the day, between @@ -59,7 +59,7 @@ in ''; }; night = mkOption { - type = types.int; + type = types.ints.between 1000 25000; default = 3700; description = '' Colour temperature to use at night, between From 7f0939d1e1bf13072654a1d5ea3ab3c1df06a244 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 16:15:13 +0200 Subject: [PATCH 16/17] nixos/shadow: use more accurate int types --- nixos/modules/programs/shadow.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix index e8eb756f8f59..049d5d0c78a7 100644 --- a/nixos/modules/programs/shadow.nix +++ b/nixos/modules/programs/shadow.nix @@ -77,49 +77,49 @@ in SYS_UID_MIN = lib.mkOption { description = "Range of user IDs used for the creation of system users by useradd or newusers."; default = 400; - type = lib.types.int; + type = lib.types.ints.u32; }; SYS_UID_MAX = lib.mkOption { description = "Range of user IDs used for the creation of system users by useradd or newusers."; default = 999; - type = lib.types.int; + type = lib.types.ints.u32; }; UID_MIN = lib.mkOption { description = "Range of user IDs used for the creation of regular users by useradd or newusers."; default = 1000; - type = lib.types.int; + type = lib.types.ints.u32; }; UID_MAX = lib.mkOption { description = "Range of user IDs used for the creation of regular users by useradd or newusers."; default = 29999; - type = lib.types.int; + type = lib.types.ints.u32; }; SYS_GID_MIN = lib.mkOption { description = "Range of group IDs used for the creation of system groups by useradd, groupadd, or newusers"; default = 400; - type = lib.types.int; + type = lib.types.ints.u32; }; SYS_GID_MAX = lib.mkOption { description = "Range of group IDs used for the creation of system groups by useradd, groupadd, or newusers"; default = 999; - type = lib.types.int; + type = lib.types.ints.u32; }; GID_MIN = lib.mkOption { description = "Range of group IDs used for the creation of regular groups by useradd, groupadd, or newusers."; default = 1000; - type = lib.types.int; + type = lib.types.ints.u32; }; GID_MAX = lib.mkOption { description = "Range of group IDs used for the creation of regular groups by useradd, groupadd, or newusers."; default = 29999; - type = lib.types.int; + type = lib.types.ints.u32; }; TTYGROUP = lib.mkOption { From a7a8289ee9f62f32391f4e075bf9be7d2430fe4a Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 22 Sep 2025 16:15:40 +0200 Subject: [PATCH 17/17] nixos/misc/ids: use more accurate int types --- nixos/modules/misc/ids.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index f96d90941323..949531d9a83c 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -31,7 +31,7 @@ in description = '' The user IDs used in NixOS. ''; - type = types.attrsOf types.int; + type = types.attrsOf types.ints.u32; }; ids.gids = lib.mkOption { @@ -39,7 +39,7 @@ in description = '' The group IDs used in NixOS. ''; - type = types.attrsOf types.int; + type = types.attrsOf types.ints.u32; }; };