fonts: set home-manager fonts.fontconfig.defaultFonts
Not much to see here...
Things done
- [x] Tested locally
- [ ] Tested in testbed
- [x] Commit message follows commit convention
- [x] Fits style guide
- [x] Respects license of any existing code used
Notify maintainers
Will this allow users to add their own fallback fonts for fontconfig?
Hrm... with NixOS and home-manager each providing this feature, one can already set their preferred fonts (a list that determines precedence) without stylix. It seems to me that the only benefit stylix adds on top of that is explicitly setting fonts for apps that somehow (I don't know how this works) do not obey fontconfig. Which is most likely a minority of apps.
What I meant is that if I want to add additional fallback fonts like this:
fonts.fontconfig = {
defaultFonts = {
monospace = [ myFontA ];
serif = [ myFontB ];
sansSerif = [ myFontC ];
emoji = [ myFontD ];
};
};
Will this clash with the behavior introduced in this PR?
What I meant is that if I want to add additional fallback fonts like this:
fonts.fontconfig = { defaultFonts = { monospace = [ myFontA ]; serif = [ myFontB ]; sansSerif = [ myFontC ]; emoji = [ myFontD ]; }; };Will this clash with the behavior introduced in this PR?
No, the definitions should be merged automatically.
Oh yeah, I can confirm that it works.
This config:
stylix.enable = true;
fonts.fontconfig.defaultFonts = {
monospace = [ "myFontA" "myFontB" ];
serif = [ "myFontC" "myFontD" ];
sansSerif = [ "myFontE" "myFontF" ];
emoji = [ "myFontG" "myFontH" ];
};
Will produce:
nix-repl> :p config.fonts.fontconfig.defaultFonts
{
emoji = [
"Noto Color Emoji"
"myFontG"
"myFontH"
];
monospace = [
"DejaVu Sans Mono"
"myFontA"
"myFontB"
];
sansSerif = [
"DejaVu Sans"
"myFontE"
"myFontF"
];
serif = [
"DejaVu Serif"
"myFontC"
"myFontD"
];
}
But we should treat fontconfig as a target right? So that users can enable/disable it.
But we should treat
fontconfigas a target right? So that users can enable/disable it.
Well the equivalent NixOS module doesn't seem to introduce a target:
https://github.com/nix-community/stylix/blob/34b5930894d8315401d93bd8a9a6635e1cd28eff/stylix/nixos/fonts.nix
But we should treat
fontconfigas a target right? So that users can enable/disable it.Well the equivalent NixOS module doesn't seem to introduce a target:
https://github.com/nix-community/stylix/blob/34b5930894d8315401d93bd8a9a6635e1cd28eff/stylix/nixos/fonts.nix
Interesting, you're right. This seems like bad practice and just vestigial code from the very early days of Stylix. I support making a font-config module with NixOS and Home Manager targets.
CC: @danth
Interesting, you're right. This seems like bad practice and just vestigial code from the very early days of Stylix. I support making a
font-configmodule with NixOS and Home Manager targets.
#1381
Yes, I agree, we should move fontconfig to a target :))
Successfully created backport PR for release-25.05:
- #1475
Thanks everyone!