2024-10-18 00:00:48 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
cfg = config.alqueva.fonts;
|
|
|
|
inherit (lib) types mkOption;
|
2024-10-29 15:37:11 +00:00
|
|
|
mkStringsOption = default: letterform:
|
2024-10-18 00:00:48 +01:00
|
|
|
mkOption {
|
2024-10-29 15:37:11 +00:00
|
|
|
type = types.listOf types.str;
|
|
|
|
inherit default;
|
2024-11-26 13:51:16 +00:00
|
|
|
description = "The default fonts for ${letterform}.";
|
|
|
|
};
|
|
|
|
mkPackagesOption = default: letterform:
|
|
|
|
mkOption {
|
|
|
|
type = types.listOf types.package;
|
|
|
|
inherit default;
|
|
|
|
description = "The packages you want to use for your ${letterform} fonts.";
|
2024-10-18 00:00:48 +01:00
|
|
|
};
|
|
|
|
in {
|
|
|
|
options.alqueva.fonts = {
|
2024-10-29 15:37:11 +00:00
|
|
|
enable = lib.mkEnableOption "" // {description = "Whether you want to use this fonts module.";};
|
2024-11-26 13:51:16 +00:00
|
|
|
packages =
|
|
|
|
{
|
|
|
|
extra = mkOption {
|
|
|
|
type = types.listOf types.package;
|
|
|
|
default = [];
|
|
|
|
description = "Extra font packages you want installed.";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// builtins.mapAttrs (_n: v: mkPackagesOption v.default v.letterform) {
|
|
|
|
sansSerif = {
|
|
|
|
default = [pkgs.roboto];
|
|
|
|
letterform = "sans-serif";
|
|
|
|
};
|
|
|
|
monospace = {
|
|
|
|
default = [pkgs.roboto-mono];
|
|
|
|
letterform = "monospace";
|
|
|
|
};
|
|
|
|
serif = {
|
|
|
|
default = [pkgs.roboto-serif];
|
|
|
|
letterform = "serif";
|
|
|
|
};
|
|
|
|
emoji = {
|
|
|
|
default = [pkgs.noto-fonts-color-emoji];
|
|
|
|
letterform = "emoji";
|
|
|
|
};
|
|
|
|
};
|
2024-10-29 15:37:11 +00:00
|
|
|
names = builtins.mapAttrs (_n: v: mkStringsOption v.default v.letterform) {
|
|
|
|
sansSerif = {
|
|
|
|
default = ["Roboto"];
|
|
|
|
letterform = "sans-serif";
|
|
|
|
};
|
|
|
|
monospace = {
|
|
|
|
default = ["Roboto Mono"];
|
|
|
|
letterform = "monospace";
|
|
|
|
};
|
|
|
|
serif = {
|
|
|
|
default = ["Roboto Serif"];
|
|
|
|
letterform = "serif";
|
|
|
|
};
|
|
|
|
emoji = {
|
|
|
|
default = ["Noto Color Emoji"];
|
|
|
|
letterform = "emoji";
|
|
|
|
};
|
2024-10-18 00:00:48 +01:00
|
|
|
};
|
|
|
|
};
|
2024-10-18 17:59:58 +01:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-10-18 00:00:48 +01:00
|
|
|
fonts = {
|
2024-11-26 13:51:16 +00:00
|
|
|
packages = builtins.concatLists (builtins.attrValues cfg.packages);
|
2024-10-18 00:00:48 +01:00
|
|
|
fontconfig = {
|
|
|
|
defaultFonts = {
|
2024-10-29 15:37:11 +00:00
|
|
|
inherit (cfg.names) sansSerif monospace serif emoji;
|
2024-10-18 00:00:48 +01:00
|
|
|
};
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|