overlays/iosevka: refactor

iosevka overlay now uses iosevka config build plans in extesible forms!
This commit is contained in:
Primrose 2026-01-22 21:18:32 +01:00
parent acab4af809
commit f2bd846e22
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
7 changed files with 325 additions and 193 deletions

View file

@ -0,0 +1,59 @@
# A thicker family of custom build of iosevkas. Optimized for Haskell and Nix.
final: prev:
let
inherit (prev) lib;
iosevkaConfig = final: import ./privateBuildPlan.nix;
mkIosevka =
mergedConfig:
prev.iosevka.override {
# HACK:
# Used to construct pname internally, appended to "Iosevka".
# We drop the prefix so it is not duplicated.
set = lib.removePrefix "Iosevka" mergedConfig.family;
privateBuildPlan = mergedConfig;
};
mkNerdFont =
font:
final.callPackage ../../lib/mkNerdFont.nix { } {
inherit font;
patcherArgs = [
"--complete"
"--careful"
"--name {/.}-NFM"
"--mono"
];
};
identityOverlay = _: _: { };
overlays =
lib.crossLists
(
spacingCfg: variantCfg:
lib.composeManyExtensions [
spacingCfg
variantCfg
]
)
[
(import ./spacings.nix { inherit lib; })
([ identityOverlay ] ++ import ./variants.nix)
];
iosevkas = lib.genAttrs' overlays (
overlay:
let
mergedConfig = lib.fix (lib.extends overlay iosevkaConfig);
toKebabCase = x: builtins.replaceStrings [ " " ] [ "-" ] (lib.toLower x);
in
lib.nameValuePair (toKebabCase mergedConfig.family) (mkIosevka mergedConfig)
);
iosevka-nerds = builtins.mapAttrs (_: mkNerdFont) iosevkas;
in
iosevkas
// {
nerd-fonts = prev.nerd-fonts // iosevka-nerds;
}