Skip to content

gtk3: hardcode gsettings schemas#271037

Draft
jtojnar wants to merge 1 commit intoNixOS:stagingfrom
jtojnar:gtk-hardcode-schemas
Draft

gtk3: hardcode gsettings schemas#271037
jtojnar wants to merge 1 commit intoNixOS:stagingfrom
jtojnar:gtk-hardcode-schemas

Conversation

@jtojnar
Copy link
Member

@jtojnar jtojnar commented Nov 29, 2023

Description of changes

This should hopefully prevent the crashes of unwrapped apps using GTK file chooser.

Fixes: #149812

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Priorities

Add a 👍 reaction to pull requests you find important.

This should hopefully prevent the crashes of unwrapped apps using GTK file chooser.
@jtojnar jtojnar marked this pull request as draft November 29, 2023 21:45
+ g_autoptr(GSettingsSchemaSource) schema_source;
+ g_autoptr(GSettingsSchema) schema;
+ schema_source = g_settings_schema_source_new_from_directory("@gtk@",
+ g_settings_schema_source_get_default(),
Copy link
Member Author

@jtojnar jtojnar Nov 29, 2023

Choose a reason for hiding this comment

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

Since we are calling lookup with recursive=FALSE, the parent argument is actually pointless and can just be NULL.

prePatch = ''
substitute ${./patches/3.0-hardcode-gsettings.patch} hardcode-gsettings.patch \
--subst-var-by gtk ${glib.makeSchemaPath "$out" "${finalAttrs.pname}-${finalAttrs.version}"}
patches="$patches $PWD/hardcode-gsettings.patch"
Copy link
Member Author

Choose a reason for hiding this comment

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

Needs comment.

+ schema_source = g_settings_schema_source_new_from_directory("@gtk@",
+ g_settings_schema_source_get_default(),
+ TRUE, NULL);
+ schema = g_settings_schema_source_lookup(schema_source, "org.gtk.Demo",
Copy link
Member Author

Choose a reason for hiding this comment

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

The default schema source is what implements overriding schema with environment variables so when we do not use it, the extraGSettingsOverrides NixOS option will be without effect.

We should probably tweak the patch to check the default schema first and only look in the hardcoded one when the schema is missing in the default one.

@AndersonTorres
Copy link
Member

Typo on "gsettinGs"

@ofborg ofborg bot added 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Nov 30, 2023
@jtojnar jtojnar mentioned this pull request Dec 10, 2023
13 tasks
@SuperSandro2000
Copy link
Member

This should hopefully prevent the crashes of unwrapped apps using GTK file chooser.

Can we then remove them from all the wrapper?

@jtojnar
Copy link
Member Author

jtojnar commented Dec 10, 2023

Can we then remove them from all the wrapper?

Yeah, hopefully, this would make wrapGAppsHook in QT apps obsolete. Will require testing though.

@amaxine amaxine changed the title gtk3: hardcode gsettins schemas gtk3: hardcode gsettings schemas Apr 27, 2024
@amaxine amaxine removed their request for review April 27, 2024 17:56
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
@nixos-discourse
Copy link

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 7, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 2, 2025
@FliegendeWurst FliegendeWurst mentioned this pull request Jan 12, 2025
13 tasks
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Feb 15, 2025
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Feb 15, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 25, 2025
@SuperSandro2000
Copy link
Member

This seems to be a bigger concern with the 25.11 and the gnome/gtk there. Can we revive this and merge it?

@nixpkgs-ci nixpkgs-ci bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 10, 2025
@Aleksanaa Aleksanaa mentioned this pull request Dec 24, 2025
13 tasks
@ilya-fedin ilya-fedin mentioned this pull request Feb 16, 2026
3 tasks
ilkecan added a commit to ilkecan/config that referenced this pull request Feb 23, 2026
ilkecan added a commit to ilkecan/config that referenced this pull request Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants