summary refs log tree commit diff
path: root/lib/generators.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generators.nix')
-rw-r--r--lib/generators.nix15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/generators.nix b/lib/generators.nix
index 073bb6982e14..aa6759087031 100644
--- a/lib/generators.nix
+++ b/lib/generators.nix
@@ -177,13 +177,15 @@ rec {
 
   # PLIST handling
   toPlist = {}: v: let
-    expr = ind: x: with builtins;
-      if isNull x then "" else
-      if isBool x then bool ind x else
-      if isInt x then int ind x else
+    isFloat = builtins.isFloat or (x: false);
+    expr = ind: x:  with builtins;
+      if isNull x   then "" else
+      if isBool x   then bool ind x else
+      if isInt x    then int ind x else
       if isString x then str ind x else
-      if isList x then list ind x else
-      if isAttrs x then attrs ind x else
+      if isList x   then list ind x else
+      if isAttrs x  then attrs ind x else
+      if isFloat x  then float ind x else
       abort "generators.toPlist: should never happen (v = ${v})";
 
     literal = ind: x: ind + x;
@@ -192,6 +194,7 @@ rec {
     int = ind: x: literal ind "<integer>${toString x}</integer>";
     str = ind: x: literal ind "<string>${x}</string>";
     key = ind: x: literal ind "<key>${x}</key>";
+    float = ind: x: literal ind "<real>${toString x}</real>";
 
     indent = ind: expr "\t${ind}";