nix-community / dconf2nix

:feet: Convert dconf files (e.g. GNOME Shell) to Nix, as expected by Home Manager [maintainer=@jtojnar]
Apache License 2.0
218 stars 6 forks source link

Nix: Use mkDouble constructor for doubles #106

Closed jtojnar closed 1 month ago

jtojnar commented 1 month ago

Nix truncates floats, which makes the float literal unsuitable for keys that expect certain level of precision and reset the key otherwise, like /org/gnome/shell/world-clocks/locations.

https://www.github.com/NixOS/nix/issues/5733#issuecomment-1529002378 https://discourse.nixos.org/t/set-a-dconf-key-without-double-quotes/36142

nix-repl> builtins.toJSON [ [(-0.65740735740229495) 2.5278185274873568] [(-0.6600253512802865) 2.5301456447922108] ]
"[[-0.657407357402295,2.527818527487357],[-0.6600253512802865,2.530145644792211]]"

nix-repl> builtins.toString (-0.65740735740229495)
"-0.657407"

Fixes: https://github.com/nix-community/dconf2nix/issues/98