{font-packages,fontconfig}: init (#1381)

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

Reviewed-by: Flameopathic <64027365+Flameopathic@users.noreply.github.com>
Reviewed-by: awwpotato <awwpotato@voidq.com>
Reviewed-by: Matt Sturgeon <matt@sturgeon.me.uk>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
NAHO 2025-06-04 15:30:56 +02:00 committed by GitHub
commit 7e9cced782
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 96 additions and 38 deletions

View file

@ -0,0 +1,13 @@
{ mkTarget, ... }:
mkTarget {
name = "font-packages";
humanName = "Font packages";
configElements =
{ fonts }:
{
fonts = {
inherit (fonts) packages;
};
};
}

View file

@ -0,0 +1,13 @@
{ mkTarget, ... }:
mkTarget {
name = "font-packages";
humanName = "Font packages";
configElements =
{ fonts }:
{
home = {
inherit (fonts) packages;
};
};
}

View file

@ -0,0 +1,15 @@
{ lib, ... }:
{
name = "Font packages";
maintainers = [ lib.maintainers.mightyiam ];
description = ''
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)
'';
}

View file

@ -0,0 +1,13 @@
{ mkTarget, ... }:
mkTarget {
name = "font-packages";
humanName = "Font packages";
configElements =
{ fonts }:
{
fonts = {
inherit (fonts) packages;
};
};
}

View file

@ -0,0 +1,9 @@
{ mkTarget, ... }:
mkTarget {
name = "fontconfig";
humanName = "Fontconfig";
configElements = {
fonts.fontconfig.enable = true;
};
}

View file

@ -0,0 +1,17 @@
{ lib, ... }:
{
name = "Fontconfig";
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.
### Related modules
<!-- If updating this section, make sure to update it on the linked pages too. -->
- [Font packages](font-packages.md)
'';
}

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

@ -9,7 +9,6 @@ let
in
{
imports = [
./fonts.nix
./palette.nix
../fonts.nix
../home-manager-integration.nix

View file

@ -1,7 +0,0 @@
{ config, lib, ... }:
{
config.fonts = lib.mkIf config.stylix.enable {
inherit (config.stylix.fonts) packages;
};
}

View file

@ -10,7 +10,6 @@ in
{
imports = [
./cursor.nix
./fonts.nix
./icon.nix
./palette.nix
../cursor.nix

View file

@ -1,11 +0,0 @@
{ config, lib, ... }:
let
cfg = config.stylix.fonts;
in
{
config = lib.mkIf config.stylix.enable {
fonts.fontconfig.enable = true;
home.packages = cfg.packages;
};
}

View file

@ -10,7 +10,6 @@ in
{
imports = [
./cursor.nix
./fonts.nix
./palette.nix
../cursor.nix
../fonts.nix

View file

@ -1,17 +0,0 @@
{ config, lib, ... }:
let
cfg = config.stylix.fonts;
in
{
config.fonts = lib.mkIf config.stylix.enable {
inherit (cfg) packages;
fontconfig.defaultFonts = {
monospace = [ cfg.monospace.name ];
serif = [ cfg.serif.name ];
sansSerif = [ cfg.sansSerif.name ];
emoji = [ cfg.emoji.name ];
};
};
}