Skip to content

Install gsettings schemas#54083

Closed
hedning wants to merge 3 commits intoNixOS:masterfrom
hedning:install-gsettings-schemas
Closed

Install gsettings schemas#54083
hedning wants to merge 3 commits intoNixOS:masterfrom
hedning:install-gsettings-schemas

Conversation

@hedning
Copy link
Contributor

@hedning hedning commented Jan 16, 2019

Motivation for this change

Provide global access to gsettings schemas of installed packages.

resolves #19590
resolves #54082

Will also help with various plugins that's picked up from the global environment, but which doesn't expose its own gsettings schemas properly (eg. #42176)

Things done

Running with this on my machine right now.

This provides global access to the gsettigs schemas of installed packages.
@hedning hedning requested a review from infinisil as a code owner January 16, 2019 19:08
@GrahamcOfBorg GrahamcOfBorg added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jan 16, 2019
@hedning hedning requested a review from jtojnar January 17, 2019 10:30
Copy link
Member

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch looks fine to me. However, I am still not convinced that this is the way to go. In my opinion, purity is one of the main benefits of Nix and I would like to push it beyond practicality – for example I was recently contemplating a setup hook that would patch C source code replacing g_settings_new with g_settings_schema_source_new_from_directory+g_settings_schema_source_new_from_directory+g_settings_new_full.

environment.systemPackages = pkgs.gnome3.corePackages ++ cfg.sessionPath
++ (removePackagesByName pkgs.gnome3.optionalPackages config.environment.gnome3.excludePackages) ++ [
pkgs.xdg-user-dirs # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
pkgs.gnome3.mutter # Give eg. gnome-control-center access to schema
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, mutter was required by g-c-c for keyboard panel, not schemas.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fetches (and sets) the keybindings from mutters schema. I can make the comment explicit that it's the keyboard panel functionality that require them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right. The keybindings XML files point to schemas. I think I have somewhere g-c-c patch that adds schemafile argument to KeyListEntries element from the time I wanted to get rid of sessionPath.

Co-Authored-By: hedning <torhedinbronner@gmail.com>
@Mic92
Copy link
Member

Mic92 commented Jan 17, 2019

I share the opinion of @jtojnar, while it is annoying at first to add these wrappers to nixpkgs say are more robust in the end then the situation we have with qt, where one can no longer run applications from nix-shell due missing paths in the profile.

@hedning
Copy link
Contributor Author

hedning commented Jan 17, 2019

I should've made the motivation clearer.

Run time dependencies should still be handled by wrappers, patching the source, or by automatically hardcoding paths like @jtojnar alluded to (if we could fix this in glib that would be really great).

This PR isn't meant to address those issues.

This is meant to address optional run time dependencies on schemas. Perhaps best exemplified by dconf-editor which doesn't require any single schema in particular, but gives the user easy access to modify those it can find. Currently, using dconf-editor is a pretty bad experience (it will show random stuff that have snuck in through wrappers, eg. vte terminals). Another example is gnome-control-center which builds it's keyboard panel using various schemas (from things like mutter, but also gpaste).

So while we all agree it's pretty poor design to pick up build times dependencies from the global environment. It's actually sometimes used correctly to pick up optional run time dependencies. Solving this at build time isn't really approriate as it will bloat closures and will never be complete.

@jtojnar
Copy link
Member

jtojnar commented Jan 17, 2019

Well, schemas are almost never optional dependency. We can almost always either wrap the program, or replace g_settings_new with the trio mentioned above. I can only recall two instances of data files being dependent on GSettings schemas:

  • the GNOME Control Center keybindings XML brought up it this PR
  • AutostartCondition= desktop files (e.g. ${orca}/etc/xdg/autostart/orca-autostart.desktop), interpreted by gnome-session

I already have somewhat messy patch for the first one and the second one should not be that big of a problem either.

dconf-editor and gsettings utility are exceptions, where all schemas are optional. But for these, this patch would not help for schemas installed by libraries, unless explicitly added to systemPackages. Actually, the only advantage this has on sessionPath is that it does not require another option in configuration.nix. I think the correct approach here is some kind of introspection of profiles’ transitive dependencies in a wrapper; conflict resolution would be the hardest part.

@jtojnar
Copy link
Member

jtojnar commented Jan 17, 2019

Actually, I already wrote the introspection code #33277 (comment), we only need to replace --references with --requisites and we can just wrap dconf-editor with it. GLib will resolve the conflicts automatically, since it basically traverses a linked list until it finds the required schema. Only disadvantage is the performance.

@hedning
Copy link
Contributor Author

hedning commented Jan 17, 2019

Actually, I already wrote the introspection code #33277 (comment), we only need to replace --references with --requisites and we can just wrap dconf-editor with it. GLib will resolve the conflicts automatically, since it basically traverses a linked list until it finds the required schema. Only disadvantage is the performance.

Nice, that would be a better solution (at least if the performance is okay) 👍. As you said, it's not a very common pattern (though not having access to through dconf-editor is a bit jarring, especially for new users I'd imagine).

I'll close this in favor of your suggested solution.

@hedning hedning closed this Jan 17, 2019
@jtojnar jtojnar mentioned this pull request Jan 17, 2019
6 tasks
@jtojnar
Copy link
Member

jtojnar commented Jan 19, 2019

For the record, gst-inspect-1.0 has similar issue and we also solved it by $NIX_PROFILE-aware wrapper: #10559 (comment)

@hedning hedning deleted the install-gsettings-schemas branch March 1, 2020 11:53
worldofpeace added a commit to worldofpeace/nixpkgs that referenced this pull request Mar 29, 2020
We shouldn't need to use wrapGAppsHook in expressions
that use this builder. The code to do this is from NixOS#54083.
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/gnome-control-center-wont-start-gpaste-settings-schema-not-installed/7479/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install gsettings schemas GNOME keyboard shortcuts settings incomplete

5 participants