diff --git a/flake.nix b/flake.nix index e0d0c37..136911a 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,7 @@ modules = [ inputs.rose-pine.homeManagerModules.rose-pine ./modules/home/shellAbbrs.nix + ./modules/home/iconTheme.nix ./home ]; }; diff --git a/home/appearance/default.nix b/home/appearance/default.nix index 228b3de..bac522c 100644 --- a/home/appearance/default.nix +++ b/home/appearance/default.nix @@ -6,6 +6,11 @@ rose-pine.pointerCursor.enable = true; + home.iconTheme = { + package = pkgs.kora-icon-theme; + name = "kora"; + }; + fonts.fontconfig.defaultFonts.monospace = [ "Maple Mono NF" ]; imports = [ diff --git a/home/appearance/gtk.nix b/home/appearance/gtk.nix index 1ebdaf7..b4a8eb7 100644 --- a/home/appearance/gtk.nix +++ b/home/appearance/gtk.nix @@ -1,13 +1,8 @@ -{ pkgs, ... }: +{ ... }: { gtk = { enable = true; rose-pine.enable = true; - - iconTheme = { - package = pkgs.kora-icon-theme; - name = "kora"; - }; }; } diff --git a/home/services/dunst.nix b/home/services/dunst.nix index 7a0b227..9bf3f89 100644 --- a/home/services/dunst.nix +++ b/home/services/dunst.nix @@ -1,5 +1,4 @@ { - pkgs, config, lib, ... @@ -12,12 +11,6 @@ # drop-in weirdness. rose-pine.enable = false; - # TODO: Set this globally and import it. - iconTheme = { - package = pkgs.kora-icon-theme; - name = "Kora"; - }; - settings = lib.mkMerge [ ### Rose Pine ### # TODO: Set this conditionally based on current theme. diff --git a/modules/home/iconTheme.nix b/modules/home/iconTheme.nix new file mode 100644 index 0000000..265bfb2 --- /dev/null +++ b/modules/home/iconTheme.nix @@ -0,0 +1,60 @@ +{ lib, config, ... }: + +with lib; + +let + # https://github.com/nix-community/home-manager/blob/master/modules/misc/gtk.nix + iconThemeType = types.submodule { + options = { + package = mkOption { + type = types.nullOr types.package; + default = null; + example = literalExpression "pkgs.gnome.adwaita-icon-theme"; + description = '' + Package providing the icon theme. This package will be installed + to your profile. If `null` then the theme + is assumed to already be available in your profile. + ''; + }; + + name = mkOption { + type = types.str; + example = "Adwaita"; + description = "The name of the icon theme within the package."; + }; + }; + }; +in +{ + options = { + home = { + iconTheme = mkOption { + type = types.nullOr iconThemeType; + default = null; + description = '' + The icon theme to use. + ''; + }; + }; + }; + + config = + let + cfg = config.home.iconTheme; + in + { + gtk = mkIf config.gtk.enable (mkDefault { + iconTheme = { + name = cfg.name; + package = cfg.package; + }; + }); + + services.dunst = mkIf config.services.dunst.enable (mkDefault { + iconTheme = { + name = cfg.name; + package = cfg.package; + }; + }); + }; +}