diff options
author | Silvan Mosberger <contact@infinisil.com> | 2019-12-13 00:24:30 +0100 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2020-07-29 18:06:34 +0200 |
commit | 9df69cba054c3b5d3a3b67778e0d2947eba3f297 (patch) | |
tree | fd3f0b6c510ef5413dd582f3ffb01584756d0bf1 /lib/generators.nix | |
parent | 5ae3fb2c3804a74251c359d603e00bd947aaea15 (diff) |
lib/generators: Extend mkValueStringDefault with float support
Diffstat (limited to 'lib/generators.nix')
-rw-r--r-- | lib/generators.nix | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/generators.nix b/lib/generators.nix index efe6ea6031d3..abd237eb7d37 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); |