Skip to content

Conversation

@daniel-sampliner
Copy link

@daniel-sampliner daniel-sampliner commented Oct 8, 2025

Description

Changing KDE font settings using GUI causes it to convert $XDG_CONFIG_HOME/fontconfig/conf.d/10-hm-fonts.conf to a plain file and then insert its own settings.

A bug was filed upstream1, however upstream does not appear receptive to making any changes.

Instead of patching KDE as suggested by upstream, we can simply work around the behavior by providing a mutable file for KDE to do what it wants with. Since it appears that KDE will always use the first file it finds2, we create the mutable file 00-aaa-local.conf.

Fixes: #5162

Checklist

  • Change is backwards compatible.

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

  • Code tested through nix run .#tests -- test-all or
    nix-shell --pure tests -A run.all.

  • 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.
    • Generate a news entry. See News
    • Basic tests added. See Tests
  • If this PR adds an exciting new feature or contains a breaking change.

    • Generate a news entry. See News

Footnotes

  1. https://bugs.kde.org/show_bug.cgi?id=498694

  2. https://github.com/KDE/plasma-workspace/blob/83bebc7896986eb27e0e1a8c62edaa98f567e2ce/kcms/fonts/kxftconfig.cpp#L192

Changing KDE font settings using GUI causes it to convert
`$XDG_CONFIG_HOME/fontconfig/conf.d/10-hm-fonts.conf` to a plain file
and then insert its own settings.

A bug was filed upstream[^1], however upstream does not appear receptive to
making any changes.

Instead of patching KDE as suggested by upstream, we can simply work
around the behavior by providing a mutable file for KDE to do what it
wants with. Since it appears that KDE will always use the first file it
finds[^2], we create the mutable file `00-aaa-mutable.conf`.

[^1]: https://bugs.kde.org/show_bug.cgi?id=498694
[^2]: https://github.com/KDE/plasma-workspace/blob/83bebc7896986eb27e0e1a8c62edaa98f567e2ce/kcms/fonts/kxftconfig.cpp#L192

Fixes: nix-community#5162
@home-manager-ci home-manager-ci bot requested review from bmrips and rycee October 8, 2025 19:25
@bmrips
Copy link
Contributor

bmrips commented Oct 27, 2025

Looks overall good to me! Can't we even remove the enableMutablePlaceholder guard, since the change is backwards compatible and does not have any downside? Or am I overlooking something?

However, it was failing with an error I couldn't determine the cause of:

In the test environment, the pkgs set is stubbed, i.e., the outPath of all packages is @<name>@. This also holds for systemd, such that xdg.configFile."...".source = "@systemd@/..." is not an absolute path anymore and the type-check fails. To fix this error, you have to modify the stub such that outPath is not stubbed, which can be achieved by setting test.stubs.systemd.outPath = null;.

@daniel-sampliner
Copy link
Author

My reasoning for enableMutablePlaceholder guard is because the change introduces "impurity". Even though the change is backwards incompatible, it still may be better to make it explicitly opt-in (especially since the issue only affects certain Desktop Managers that are being configured imperatively or via UI).

Good to know regarding the test stub! I will give that a shot and update the tests.

@bmrips
Copy link
Contributor

bmrips commented Oct 30, 2025

Yes, I get that. In case that #8084 is accepted, there also is the option to change the rule type from C to L+$, such that the placeholder is linked, overwritten on login, and deleted when fontconfig gets disabled. The only downside is that, in case that KDE picks up on the placeholder, the changes done through the GUI will be overwritten.

@daniel-sampliner
Copy link
Author

Perhaps the best way to handle the mutability would be under the DE's submodule? For example in KDE's module, when enabled it would enable the fontconfig mutable placeholder. Additionally KDE's module could expose a toggle whether to wipe out GUI changes or not?

Although I don't use home-manager to configure my DE at all so I don't know if this fits into the current model of things.

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: Unable to nixos-rebuild after changing KDE settings using the GUI.

2 participants