lib/generators: Extend mkValueStringDefault with float support

This commit is contained in:
Silvan Mosberger 2019-12-13 00:24:30 +01:00
parent 5ae3fb2c38
commit 9df69cba05
No known key found for this signature in database
GPG key ID: E8F1E9EAD284E17D

View file

@ -48,8 +48,10 @@ rec {
else if isAttrs v then err "attrsets" v
# functions cant be printed of course
else if isFunction v then err "functions" v
# lets 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);