Comments (15)
Try master
, it generates this: https://github.com/gvolpe/dconf2nix/blob/master/output/json.nix
from dconf2nix.
How about this? This is how dconf2nix
generates the entry.
"org/gnome/shell/extensions/sound-output-device-chooser" = {
ports-settings = ''
{"version":2,"ports":[]}
'';
};
from dconf2nix.
"org/gnome/shell/extensions/sound-output-device-chooser" = { ports-settings = '' {"version":2,"ports":[]} ''; };
With this form, home-manager switch
ends up with that error message:
Starting home manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
replacing old 'home-manager-path'
installing 'home-manager-path'
Activating dconfSettings
error: Key file contains line “'” which is not a key-value pair, group, or comment
from dconf2nix.
Okay. You're going to have to ask that to the Home Manager folks, maybe JSON is not even supported. If it requires escaping quotes or some different implementation, I'd be happy to work on it, but we need to be sure that HM supports it.
from dconf2nix.
Double quoting the JSON string and escaping the quotes inside works in my testing, though I don't know if we want to wait for some official clarification on what style is preferred.
from dconf2nix.
@johanbrandhorst can you share input and expected output? If that works for you, I can work on it. I don't use any JSON-like entries so this is not a problem for me :)
from dconf2nix.
Sure thing. The following input:
panel-element-positions='{"0":[{"element":"showAppsButton","visible":false,"position":"stackedTL"},{"element":"activitiesButton","visible":false,"position":"stackedTL"},{"element":"leftBox","visible":true,"position":"stackedTL"},{"element":"taskbar","visible":true,"position":"stackedTL"},{"element":"centerBox","visible":true,"position":"stackedBR"},{"element":"rightBox","visible":true,"position":"stackedBR"},{"element":"dateMenu","visible":true,"position":"stackedBR"},{"element":"systemMenu","visible":true,"position":"stackedBR"},{"element":"desktopButton","visible":true,"position":"stackedBR"}],"1":[{"element":"showAppsButton","visible":false,"position":"stackedTL"},{"element":"activitiesButton","visible":false,"position":"stackedTL"},{"element":"leftBox","visible":true,"position":"stackedTL"},{"element":"taskbar","visible":true,"position":"stackedTL"},{"element":"centerBox","visible":true,"position":"stackedBR"},{"element":"rightBox","visible":true,"position":"stackedBR"},{"element":"dateMenu","visible":true,"position":"stackedBR"},{"element":"systemMenu","visible":true,"position":"stackedBR"},{"element":"desktopButton","visible":true,"position":"stackedBR"}]}'
Should ideally produce the following output:
panel-element-positions = "{\"0\":[{\"element\":\"showAppsButton\",\"visible\":false,\"position\":\"stackedTL\"},{\"element\":\"activitiesButton\",\"visible\":false,\"position\":\"stackedTL\"},{\"element\":\"leftBox\",\"visible\":true,\"position\":\"stackedTL\"},{\"element\":\"taskbar\",\"visible\":true,\"position\":\"stackedTL\"},{\"element\":\"centerBox\",\"visible\":true,\"position\":\"stackedBR\"},{\"element\":\"rightBox\",\"visible\":true,\"position\":\"stackedBR\"},{\"element\":\"dateMenu\",\"visible\":true,\"position\":\"stackedBR\"},{\"element\":\"systemMenu\",\"visible\":true,\"position\":\"stackedBR\"},{\"element\":\"desktopButton\",\"visible\":true,\"position\":\"stackedBR\"}],\"1\":[{\"element\":\"showAppsButton\",\"visible\":false,\"position\":\"stackedTL\"},{\"element\":\"activitiesButton\",\"visible\":false,\"position\":\"stackedTL\"},{\"element\":\"leftBox\",\"visible\":true,\"position\":\"stackedTL\"},{\"element\":\"taskbar\",\"visible\":true,\"position\":\"stackedTL\"},{\"element\":\"centerBox\",\"visible\":true,\"position\":\"stackedBR\"},{\"element\":\"rightBox\",\"visible\":true,\"position\":\"stackedBR\"},{\"element\":\"dateMenu\",\"visible\":true,\"position\":\"stackedBR\"},{\"element\":\"systemMenu\",\"visible\":true,\"position\":\"stackedBR\"},{\"element\":\"desktopButton\",\"visible\":true,\"position\":\"stackedBR\"}]}";
from dconf2nix.
Ah okay so you meant escaping the double-quotes within the main double-quotes. I think this could be a potential workaround but let's wait a bit for the HM folks, I believe the current output produced by dconf2nix
should be the way to go (raw JSON wrapped in double single-quotes, which allow multiline strings) since it's perfectly valid Nix.
from dconf2nix.
The current output of that input is not double single quotes in my experience. It produces:
panel-element-positions = "'{"0":[{"element":"showAppsButton","visible":false,"position":"stackedTL"},{"element":"activitiesButton","visible":false,"position":"stackedTL"},{"element":"leftBox","visible":true,"position":"stackedTL"},{"element":"taskbar","visible":true,"position":"stackedTL"},{"element":"centerBox","visible":true,"position":"stackedBR"},{"element":"rightBox","visible":true,"position":"stackedBR"},{"element":"dateMenu","visible":true,"position":"stackedBR"},{"element":"systemMenu","visible":true,"position":"stackedBR"},{"element":"desktopButton","visible":true,"position":"stackedBR"}],"1":[{"element":"showAppsButton","visible":false,"position":"stackedTL"},{"element":"activitiesButton","visible":false,"position":"stackedTL"},{"element":"leftBox","visible":true,"position":"stackedTL"},{"element":"taskbar","visible":true,"position":"stackedTL"},{"element":"centerBox","visible":true,"position":"stackedBR"},{"element":"rightBox","visible":true,"position":"stackedBR"},{"element":"dateMenu","visible":true,"position":"stackedBR"},{"element":"systemMenu","visible":true,"position":"stackedBR"},{"element":"desktopButton","visible":true,"position":"stackedBR"}]}'";
from dconf2nix.
master
does indeed work fine for me, but I found a separate issue, will raise it separately.
from dconf2nix.
I've received the following feedback from nix-community/home-manager#2096 (comment):
The issue seems to be that multiline strings written in that fashion have a leading newline.
I don't use the dconf module/configuration so I don't know whether HM could always strip the first newline of a string.
It could break some wild configuration out there I suppose.
According to him, the following Nix code:
# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
{ lib, ... }:
let
mkTuple = lib.hm.gvariant.mkTuple;
in
{
dconf.settings = {
"org/gnome/shell/extensions/sound-output-device-chooser" = {
ports-settings = ''
{"version":2,"ports":[]}
'';
};
};
}
may lead to the following dconf setting:
[org/gnome/shell/extensions/sound-output-device-chooser]
ports-settings='{"version":2,"ports":[]}
'
The question is: whose is the responsability from removing this trailing newline: HM itself (may it break other HM settings?), HM dconf module (can it be done for this module only?) or dconf2nix (it should generate ports-settings = ''{"version":2,"ports":[]}'';
)?
from dconf2nix.
HM master should now properly escape literal newlines in strings, which should fix the issue of invalid INI file generation.
from dconf2nix.
That's great to hear! I'll try it out soon as I can, and close this issue if all the tests pass.
from dconf2nix.
This issue seems to be fixed, with dconf2nix
built from master
(and dash-to-panel
)
from dconf2nix.
Thanks for confirming @maydayv7 , I actually forgot to check. I'll close the issue then.
from dconf2nix.
Related Issues (20)
- Emoji causes `timeout` HOT 2
- Support variant and dictionary types
- Error unexpected "%" HOT 1
- Fails if input doesn't end with newline HOT 2
- doc: error in readme HOT 1
- Special unicode character causes timeout HOT 3
- error: value is null while a set was expected HOT 1
- Timeout when there is % in a list HOT 5
- support a{sv} types HOT 1
- Stepping away, looking for maintainers HOT 8
- Support NixOS module HOT 9
- parsing error HOT 2
- error importing dconf.nix HOT 1
- Use mkDouble for doubles
- List of errors I encountered HOT 2
- Filtering HOT 2
- Problem parsing uint64 properties HOT 1
- Problem parsing array properties HOT 1
- unexpected "{" HOT 1
- World clocks dconf returns not of type gvariant value HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dconf2nix.