about summary refs log tree commit diff
path: root/lib/types.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2017-10-31 12:48:37 +0100
committerProfpatsch <mail@profpatsch.de>2017-11-05 15:56:32 +0100
commit77648da2336b4a85bbbf33866402a775e3cbdae8 (patch)
tree2b27763855fee18ac74a69b97939176842b29229 /lib/types.nix
parent7fcd3892a93912cd444832f6289307aedc3abcbd (diff)
lib/types: signed -> s, unsigned -> u, remove signed alias
Mirrors the way it’s done in modern low-level languages like Rust (by input of
@nbp).
Removes the signed alias for int.
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix28
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/types.nix b/lib/types.nix
index df141885f954e..01d82d31c83ff 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -107,18 +107,16 @@ rec {
       merge = mergeEqualOption;
     };
 
-    int = ints.signed;
+    int = mkOptionType rec {
+        name = "int";
+        description = "signed integer";
+        check = isInt;
+        merge = mergeOneOption;
+      };
 
     # specialized subdomains of int
     ints =
       let
-        int = mkOptionType rec {
-          name = "int";
-          description = "signed integer";
-          check = isInt;
-          merge = mergeOneOption;
-        };
-
         betweenDesc = lowest: highest:
           "${toString lowest} and ${toString highest} (both inclusive)";
         between = lowest: highest: assert lowest <= highest;
@@ -153,18 +151,16 @@ rec {
           name = "unsignedInt";
           description = "unsigned integer, meaning >=0";
         };
-        unsigned8 = unsign 8 256;
-        unsigned16 = unsign 16 65536;
-        unsigned32 = unsign 32 4294967296;
+        u8 = unsign 8 256;
+        u16 = unsign 16 65536;
+        u32 = unsign 32 4294967296;
         # the biggest int the nix lexer accepts is 9223372036854775808
         # the smallest int the nix lexer accepts is -9223372036854775807
         # unsigned64 = unsign 64 18446744073709551616;
 
-        signed = int;
-        signed8 = sign 8 256;
-        signed16 = sign 16 65536;
-        signed32 = sign 32 4294967296;
-
+        s8 = sign 8 256;
+        s16 = sign 16 65536;
+        s32 = sign 32 4294967296;
       };
 
     str = mkOptionType {