fontconfig: align Home Manager with NixOS and enhance docs (#1292)

BREAKING CHANGE: The fontconfig target no longer enables Home Manager's
fonts.fontconfig.enable option and now sets Home Manager's
fonts.fontconfig.defaultFonts option instead.

Link: https://github.com/nix-community/stylix/pull/1292

Reviewed-by: awwpotato <awwpotato@voidq.com>
Reviewed-by: Flameopathic <64027365+Flameopathic@users.noreply.github.com>
Reviewed-by: Matt Sturgeon <matt@sturgeon.me.uk>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
Shahar "Dawn" Or 2025-06-11 00:28:41 +07:00 committed by GitHub
parent 54703a4621
commit 6d72fc259b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 42 additions and 36 deletions

View file

@ -111,6 +111,18 @@ or at `~/.config/stylix/palette.html` on Home Manager.
## Fonts
Fonts can apply in three ways:
1. An app's own font options
(e.g. [the Alacritty module](./options/modules/alacritty.html) sets home-manager's
`programs.alacritty.settings.font`).
2. Widely, through
[the Fontconfig module](./options/modules/fontconfig.html).
3. Made available in an environment using
[the font packages module](./options/modules/font-packages.html).
The default combination of fonts is:
```nix

View file

@ -6,10 +6,6 @@
This module makes the Stylix fonts available in the environment of each of
the platforms that this module supports.
### Related modules
<!-- If updating this section, make sure to update it on the linked pages too. -->
- [Fontconfig](fontconfig.md)
Also see [general fonts documentation](../../configuration.html#fonts).
'';
}

View file

@ -0,0 +1,16 @@
{ mkTarget }:
mkTarget {
name = "fontconfig";
humanName = "Fontconfig";
configElements =
{ fonts }:
{
fonts.fontconfig.defaultFonts = {
monospace = [ fonts.monospace.name ];
serif = [ fonts.serif.name ];
sansSerif = [ fonts.sansSerif.name ];
emoji = [ fonts.emoji.name ];
};
};
}

View file

@ -1,9 +1,6 @@
{ mkTarget, ... }:
mkTarget {
name = "fontconfig";
humanName = "Fontconfig";
configElements = {
fonts.fontconfig.enable = true;
};
{ lib, mkTarget, ... }:
{
imports = [
(lib.modules.importApply ./fontconfig.nix { inherit mkTarget; })
];
}

View file

@ -4,14 +4,9 @@
homepage = "https://fontconfig.org";
maintainers = [ lib.maintainers.mightyiam ];
description = ''
On NixOS, `fonts.fontconfig.defaultFonts` options are declared without
enabling `fonts.fontconfig.enable`. On Home Manager, only the
`fonts.fontconfig.enable` option is declared and enabled.
This module adds the Stylix fonts to `fonts.fontconfig.defaultFonts` in
each of the platforms that this module supports.
### Related modules
<!-- If updating this section, make sure to update it on the linked pages too. -->
- [Font packages](font-packages.md)
Also see [general fonts documentation](../../configuration.html#fonts).
'';
}

View file

@ -1,16 +1,6 @@
{ mkTarget, ... }:
mkTarget {
name = "fontconfig";
humanName = "Fontconfig";
configElements =
{ fonts }:
{
fonts.fontconfig.defaultFonts = {
monospace = [ fonts.monospace.name ];
serif = [ fonts.serif.name ];
sansSerif = [ fonts.sansSerif.name ];
emoji = [ fonts.emoji.name ];
};
};
{ lib, mkTarget, ... }:
{
imports = [
(lib.modules.importApply ./fontconfig.nix { inherit mkTarget; })
];
}