From 794cf3b7f1be2f10c0de285b14eeb00ef754fec2 Mon Sep 17 00:00:00 2001 From: liv Date: Sat, 10 Aug 2024 22:15:21 +0200 Subject: [PATCH] add fonts module and use that instead --- home/common/desktop/default.nix | 1 + home/common/desktop/font.nix | 17 ++++++++++------ home/common/desktop/gtk.nix | 10 +++++++++ modules/home-manager/default.nix | 1 + modules/home-manager/fonts.nix | 35 ++++++++++++++++++++++++++++++++ 5 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 home/common/desktop/gtk.nix create mode 100644 modules/home-manager/fonts.nix diff --git a/home/common/desktop/default.nix b/home/common/desktop/default.nix index 1e3516b..9d84690 100644 --- a/home/common/desktop/default.nix +++ b/home/common/desktop/default.nix @@ -3,6 +3,7 @@ ./font.nix ./firefox.nix ./kitty.nix + ./gtk.nix ]; home.packages = with pkgs; [ diff --git a/home/common/desktop/font.nix b/home/common/desktop/font.nix index 966ef81..086c0cf 100644 --- a/home/common/desktop/font.nix +++ b/home/common/desktop/font.nix @@ -1,8 +1,13 @@ { imports, config, pkgs, ... }: { - home.packages = with pkgs; [ - noto-fonts - noto-fonts-emoji - ]; - - fonts.fontconfig.enable = true; + fontProfiles = { + enable = true; + monospace = { + family = "JetBrains Mono Nerd Font"; + package = pkgs.nerdfonts.override { fonts = ["JetBrainsMono"]; }; + }; + regular = { + family = "Fira Sans"; + package = pkgs.fira; + }; + }; } diff --git a/home/common/desktop/gtk.nix b/home/common/desktop/gtk.nix new file mode 100644 index 0000000..32eff3c --- /dev/null +++ b/home/common/desktop/gtk.nix @@ -0,0 +1,10 @@ +{ config, pkgs, inputs, lib, ... }: { + gtk = { + enable = true; + font = { + name = config.fontProfiles.regular.family; + package = config.fontProfiles.regular.package; + size = 12; + }; + }; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index b843d63..dbf8bb5 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,3 +1,4 @@ { monitors = import ./monitors.nix; + fonts = import ./fonts.nix; } diff --git a/modules/home-manager/fonts.nix b/modules/home-manager/fonts.nix new file mode 100644 index 0000000..0df65dc --- /dev/null +++ b/modules/home-manager/fonts.nix @@ -0,0 +1,35 @@ +{ + lib, + config, + ... +}: let + mkFontOption = kind: { + family = lib.mkOption { + type = lib.types.str; + default = null; + description = "Family name for ${kind} font profile"; + example = "Fira Code"; + }; + package = lib.mkOption { + type = lib.types.package; + default = null; + description = "Package for ${kind} font profile"; + example = "pkgs.fira-code"; + }; + }; + cfg = config.fontProfiles; +in { + options.fontProfiles = { + enable = lib.mkEnableOption "Whether to enable font profiles"; + monospace = mkFontOption "monospace"; + regular = mkFontOption "regular"; + }; + + config = lib.mkIf cfg.enable { + fonts.fontconfig.enable = true; + home.packages = [ + cfg.monospace.package + cfg.regular.package + ]; + }; +}