Open jtojnar opened 1 year ago
Yes. The loss of precision is a Nix limitation.
I wonder if there's anything else missing from the translation instructions. I'm trying to use a section from dconf dump / | dconf2nix
verbatim in NixOS configuration:
{
lib,
...
}: {
programs.dconf.profiles.user.databases = [
{
settings = let
inherit (lib.gvariant) mkTuple mkUint32 mkVariant;
in {
"org/gnome/clocks" = {
world-clocks = [
{
location = mkVariant [(mkUint32 2) (mkVariant ["Oslo" "ENGM" false [(mkTuple [1.0506882097005865 0.19344065294494067])] [(mkTuple [1.0506882097005865 0.19344065294494067])]])];
}
{
location = mkVariant [(mkUint32 2) (mkVariant ["London" "EGWU" false [(mkTuple [0.8997172294030767 (-7.272211034407213e-3)])] [(mkTuple [0.8997172294030767 (-7.272211034407213e-3)])]])];
}
{
location = mkVariant [(mkUint32 2) (mkVariant ["Sydney" "YSSY" true [(mkTuple [(-0.592539281052075) 2.638646934988996])] [(mkTuple [(-0.5913757223996479) 2.639228723041856])]])];
}
];
};
};
}
];
}
it fails with
error: cannot coerce a set to a string
I'm not sure what the issue is. It looks like it might be "Elements in a list should have same type.", but that the error handling is broken? And if it is that, how do I convert a list of strings, booleans, and lists to the same type?
Do I need to No, that doesn't change the error.mkVariant
all of them first?
That was probably fixed by https://github.com/nix-community/dconf2nix/commit/753db879fa49fd0ed5af928662f379a816c7c251
That was probably fixed by 753db87
Cool! Would you be OK to cut a release?
That was probably fixed by 753db87
It fails with a different error on dconf2nix master:
error: cannot coerce a function to a string
The relevant section of dconf dump / | ./result/bin/dconf2nix
:
"org/gnome/clocks" = {
world-clocks = [ [
(mkDictionaryEntry ["location" (mkVariant (mkTuple [ (mkUint32 2) (mkVariant (mkTuple [ "Oslo" "ENGM" false [ (mkTuple [ 1.0506882097005865 0.19344065294494067 ]) ] [ (mkTuple [ 1.0506882097005865 0.19344065294494067 ]) ] ])) ]))])
] [
(mkDictionaryEntry ["location" (mkVariant (mkTuple [ (mkUint32 2) (mkVariant (mkTuple [ "London" "EGWU" false [ (mkTuple [ 0.8997172294030767 (-7.272211034407213e-3) ]) ] [ (mkTuple [ 0.8997172294030767 (-7.272211034407213e-3) ]) ] ])) ]))])
] [
(mkDictionaryEntry ["location" (mkVariant (mkTuple [ (mkUint32 2) (mkVariant (mkTuple [ "Sydney" "YSSY" true [ (mkTuple [ (-0.592539281052075) 2.638646934988996 ]) ] [ (mkTuple [ (-0.5913757223996479) 2.639228723041856 ]) ] ])) ]))])
] ];
};
That is caused by the following difference between Nixpkgs and h-m GVariant implementation:
mkDictionaryEntry
takes two arguments instead of a list.You need to use
-(mkDictionaryEntry ["location" (mkVariant …)])
+(mkDictionaryEntry "location" (mkVariant …))
Cool! Would you be OK to cut a release?
I want to make my config parse first. Currently, there are still three issues:
[com/github/wwmm/easyeffects/streamoutputs/compressor#0]
sidechain-input-device='alsa_input.platform-snd_aloop.0.analog-stereo'
[org/gnome/gnome-commander/preferences/general]
file-list-tabs=[('file:///home/jtojnar', byte 0x00, byte 0x01, false, false), ('file:///home/jtojnar', 0x01, 0x01, false, false)]
[org/gnome/easytag]
default-path=b'/home/jtojnar/Music'
It fails with a different error on dconf2nix master:
error: cannot coerce a function to a string
The misleading error will be fixed by https://github.com/NixOS/nixpkgs/pull/308111.
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/changing-gdm-gsettings-declaratively/49579/6
The Problem
NixOS now supports dconf database generation: https://github.com/NixOS/nixpkgs/pull/234615
The Solution
Add
--nixos
flag that will make the following changes:lib.gvariant
generates instead oflib.hm.gvariant
mkDictionaryEntry
takes two arguments instead of a list.int32
needs to be explicitly constructed withmkInt32
(no implicit number literal)Alternatives
No response
Additional context
No response
Happens in the latest version