mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2025-12-12 11:36:20 +00:00
51 lines
1.4 KiB
Nix
51 lines
1.4 KiB
Nix
{ pkgs, lib, config, ... }:
|
|
with lib;
|
|
|
|
let cfg = config.fonts.fira-code;
|
|
|
|
in {
|
|
options.fonts.fira-code = {
|
|
enable = mkEnableOption "Enable the preset for Fira Code";
|
|
stylisticSets = mkOption {
|
|
type = types.listOf types.string;
|
|
description = mdDoc
|
|
"[Stylistic sets](https://github.com/tonsky/FiraCode/wiki/How-to-enable-stylistic-sets) for Fira Code";
|
|
default =
|
|
[ "zero" "onum" "ss04" "cv19" "cv23" "ss09" "ss06" "ss07" "ss10" ];
|
|
};
|
|
default = mkOption {
|
|
type = types.bool;
|
|
description = "Make Fira Code the default monospace font";
|
|
default = false;
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
fonts = {
|
|
packages = with pkgs; [ fira-code ];
|
|
nerdfonts.additionalFonts = [ "FiraCode" ];
|
|
fontconfig = {
|
|
defaultFonts.monospace = mkIf cfg.default [
|
|
(if (config.fonts.nerdfonts.enable) then
|
|
"Fira Code Nerd Font"
|
|
else
|
|
"FiraCode")
|
|
];
|
|
localConf = ''
|
|
<match target="font">
|
|
<test name="family" compare="contains">
|
|
<string>Fira</string>
|
|
</test>
|
|
<edit name="fontfeatures" mode="append">
|
|
${
|
|
lib.concatStringsSep " "
|
|
(map (set: "<string>${set}</string>") cfg.stylisticSets)
|
|
}
|
|
</edit>
|
|
</match>
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
}
|