summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Marko <srk@48.io>2018-06-30 21:13:49 +0200
committerRichard Marko <srk@48.io>2018-07-03 00:11:11 +0200
commit4a310a040413233d8e3702056b5f1c31a08ebb39 (patch)
tree0ec855ec36fe6eadcb1df6978abd09201d69d472
parent366cd2ad8ceae82e5c412ba13e351491aace3d4f (diff)
downloadnixpkgs-4a310a040413233d8e3702056b5f1c31a08ebb39.tar
nixpkgs-4a310a040413233d8e3702056b5f1c31a08ebb39.tar.gz
nixpkgs-4a310a040413233d8e3702056b5f1c31a08ebb39.tar.bz2
nixpkgs-4a310a040413233d8e3702056b5f1c31a08ebb39.tar.lz
nixpkgs-4a310a040413233d8e3702056b5f1c31a08ebb39.tar.xz
nixpkgs-4a310a040413233d8e3702056b5f1c31a08ebb39.tar.zst
nixpkgs-4a310a040413233d8e3702056b5f1c31a08ebb39.zip
lib: add float option type
-rw-r--r--lib/trivial.nix2
-rw-r--r--lib/types.nix7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 0bcefcbc28d..fac0718a9e7 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -102,7 +102,7 @@ rec {
   # Pull in some builtins not included elsewhere.
   inherit (builtins)
     pathExists readFile isBool
-    isInt add sub lessThan
+    isInt isFloat add sub lessThan
     seq deepSeq genericClosure;
 
   inherit (lib.strings) fileContents;
diff --git a/lib/types.nix b/lib/types.nix
index 5aa09d33e9b..cf6f2aa46e4 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -167,6 +167,13 @@ rec {
         # s32 = sign 32 4294967296;
       };
 
+    float = mkOptionType rec {
+        name = "float";
+        description = "floating point number";
+        check = isFloat;
+        merge = mergeOneOption;
+    };
+
     str = mkOptionType {
       name = "str";
       description = "string";