Skip to content

gtk: allow more granular customization#7349

Merged
khaneliman merged 6 commits intonix-community:masterfrom
khaneliman:gtk4
Jul 11, 2025
Merged

gtk: allow more granular customization#7349
khaneliman merged 6 commits intonix-community:masterfrom
khaneliman:gtk4

Conversation

@khaneliman
Copy link
Copy Markdown
Collaborator

@khaneliman khaneliman commented Jun 30, 2025

Description

This pull request refactors the GTK configuration module to improve flexibility, readability, and maintainability. Key changes include the introduction of global settings inheritance, per-version overrides for GTK2/3/4, and enhanced testing coverage for the new configuration structure.

Refactoring and Enhancements to GTK Configuration

  • Global Settings Inheritance:

    • Added a mechanism for global settings (e.g., font, theme, icon theme, cursor theme) to be inherited by all GTK versions (gtk2, gtk3, gtk4).
    • Introduced helper functions like mkGtkSettings to streamline attribute set generation for GTK settings.
  • Per-Version Overrides:

    • Enhanced configuration options to allow version-specific overrides for GTK2, GTK3, and GTK4. Each version can now have its own settings while optionally inheriting global defaults.

Improved Testing Structure

  • Expanded Test Coverage:
    • Reorganized test files to separate global inheritance tests from per-version override tests.
    • Added new tests to validate global inheritance and per-version overrides for GTK settings and CSS.

Closes #5133
Closes #5900

Checklist

  • Change is backwards compatible.

  • Code formatted with nix fmt or
    nix-shell -p treefmt nixfmt-rfc-style deadnix keep-sorted --run treefmt.

  • Code tested through nix-shell --pure tests -A run.all
    or nix build --reference-lock-file flake.lock ./tests#test-all using Flakes.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

Maintainer CC

@khaneliman khaneliman marked this pull request as draft July 2, 2025 19:45
@khaneliman khaneliman marked this pull request as ready for review July 2, 2025 19:45
@khaneliman
Copy link
Copy Markdown
Collaborator Author

khaneliman commented Jul 2, 2025

@zowoq Do you know if the Github App needs different permissions to read the team/member list ? https://github.com/nix-community/home-manager/actions/runs/16034340501/job/45242369177?pr=7349 I was able to get it to work without the app in my fork #6921

From what I have read, it looks like the github app just needs its GraphQL permissions updated in the organization.

@MattSturgeon
Copy link
Copy Markdown
Member

MattSturgeon commented Jul 2, 2025

error fetching organization teams: GraphQL: Resource not accessible by integration (organization.teams)

Sounds like the app needs "Organization permissions" -> "Members" -> "Read-only"

Which I believe is configured from: https://github.com/settings/apps/home-manager-ci/permissions

(as always with app perm changes, they also need "accepting" from the repo's installation, but I assume org-owners are well aware of this 😅)

@zowoq
Copy link
Copy Markdown
Contributor

zowoq commented Jul 2, 2025

Sounds like the app needs "Organization permissions" -> "Members" -> "Read-only"

Which I believe is configured from: https://github.com/settings/apps/home-manager-ci/permissions

(as always with app perm changes, they also need "accepting" from the repo's installation, but I assume org-owners are well aware of this 😅)

Done.

@khaneliman khaneliman marked this pull request as draft July 2, 2025 22:58
@khaneliman khaneliman marked this pull request as ready for review July 2, 2025 22:58
@home-manager-ci home-manager-ci bot requested a review from rycee July 2, 2025 22:59
@khaneliman
Copy link
Copy Markdown
Collaborator Author

khaneliman commented Jul 2, 2025

@zowoq sweet, it worked thanks. we will need the same thing done for the nixvim and stylix bots too

@zowoq
Copy link
Copy Markdown
Contributor

zowoq commented Jul 3, 2025

we will need the same thing done for the nixvim and stylix bots too

I'll wait until we're adding the rfc39 service for these repos to update the app permissions.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
We can now customize a lot more in the gtk module. Test more scenarios
to ensure a user has more control over what gets generated.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
The file grew in complexity while adding customization. Separate
concerns for each gtk versions customization and use lib helpers to
consolidate logic.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
Added 6 years ago, no longer needed.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
@khaneliman khaneliman merged commit f5b36e5 into nix-community:master Jul 11, 2025
5 checks passed
@khaneliman khaneliman deleted the gtk4 branch July 11, 2025 16:53
@fmbearmf
Copy link
Copy Markdown

fmbearmf commented Jul 11, 2025

home-manager.users.<user>.gtk.gtk2.force' does not exist. Definition values:

This appears to have removed the gtk.gtk2.force option. Is there a new way of forcefully overwriting?
Sorry if this is a dumb question.

@khaneliman
Copy link
Copy Markdown
Collaborator Author

home-manager.users.<user>.gtk.gtk2.force' does not exist. Definition values:

This appears to have removed the gtk.gtk2.force option. Is there a new way of forcefully overwriting? Sorry if this is a dumb question.

That would have been an accident, it should be backwards compatible. I'll fix ASAP.

@khaneliman khaneliman mentioned this pull request Jul 11, 2025
6 tasks
@khaneliman
Copy link
Copy Markdown
Collaborator Author

khaneliman commented Jul 11, 2025

Created #7437 that should fix it @fmbearmf

@nixos-discourse
Copy link
Copy Markdown

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

https://discourse.nixos.org/t/home-manager-applies-my-gtk3-theme-to-gtk4/47826/2

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: gtk.theme option assumes theme is used for GTK2, GTK3 and GTK4 bug: Impossible to disable theming for GTK4

5 participants