From 9df69cba054c3b5d3a3b67778e0d2947eba3f297 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Fri, 13 Dec 2019 00:24:30 +0100 Subject: [PATCH] lib/generators: Extend mkValueStringDefault with float support --- lib/generators.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/generators.nix b/lib/generators.nix index efe6ea6031d..abd237eb7d3 100644 --- a/lib/generators.nix +++ b/lib/generators.nix @@ -48,8 +48,10 @@ rec { else if isAttrs v then err "attrsets" v # functions can’t be printed of course else if isFunction v then err "functions" v - # let’s not talk about floats. There is no sensible `toString` for them. - else if isFloat v then err "floats" v + # Floats currently can't be converted to precise strings, + # condition warning on nix version once this isn't a problem anymore + # See https://github.com/NixOS/nix/pull/3480 + else if isFloat v then libStr.floatToString v else err "this value is" (toString v);