fontconfig: add 'configFile.<name>.target' option

This brings `fonts.fontconfig.configFile` in line with `home.file` and
the like.
This commit is contained in:
Benedikt Rips
2026-06-18 14:16:03 -05:00
committed by Austin Horstman
parent 4666af39e9
commit 4ce682641d
2 changed files with 17 additions and 3 deletions
+11 -3
View File
@@ -16,7 +16,7 @@ let
globalConfig = config;
fontConfigFileType = lib.types.submodule (
{ name, ... }:
{ config, name, ... }:
{
options = {
enable = lib.mkOption {
@@ -59,6 +59,15 @@ let
default = 90;
type = lib.types.ints.between 0 99;
};
target = lib.mkOption {
description = ''
Path to the target file relative to
{file}`''${config.xdg.configHome}/fontconfig/conf.d/`.
'';
default = "${toString config.priority}-hm-${config.label}.conf";
defaultText = ''"''${toString config.priority}-hm-''${config.label}.conf"'';
type = lib.types.nonEmptyStr;
};
text = lib.mkOption {
description = ''
Verbatim contents of the config file.
@@ -214,7 +223,6 @@ in
default = { };
description = ''
Config files that will be installed to {file}`~/.config/fontconfig/conf.d/`.
Files are named like `fontconfig/conf.d/{priority}-{label}.conf`.
'';
example = {
tamzen-disable-antialiasing = {
@@ -388,7 +396,7 @@ in
xdg.configFile = lib.mapAttrs' (
_name: config:
lib.nameValuePair "fontconfig/conf.d/${toString config.priority}-hm-${config.label}.conf" {
lib.nameValuePair "fontconfig/conf.d/${config.target}" {
inherit (config) enable text;
source = lib.mkIf (config.source != null) config.source;
}
@@ -29,6 +29,10 @@ in
priority = 37;
text = "";
};
target = {
target = "target";
text = "";
};
text.text = sampleText;
source.source = sampleSource;
};
@@ -43,6 +47,8 @@ in
assertFileExists ${fcConfD}/37-hm-priority.conf
assertFileExists ${fcConfD}/target
assertFileExists ${fcConfD}/90-hm-text.conf
assertFileContent ${fcConfD}/90-hm-text.conf \
${builtins.toFile "sample-text-config" sampleText}