diff --git a/modules/home/options/iconTheme/default.nix b/modules/home/options/iconTheme/default.nix deleted file mode 100644 index cab86f1..0000000 --- a/modules/home/options/iconTheme/default.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ lib, config, ... }: -let - inherit (lib) - types - mkOption - mkIf - mkDefault - ; - - # https://github.com/nix-community/home-manager/blob/master/modules/misc/gtk.nix - iconThemeType = types.submodule { - options = { - package = mkOption { - type = with types; nullOr package; - default = null; - example = "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 = with types; str; - example = "Adwaita"; - description = "The name of the icon theme within the package."; - }; - }; - }; -in -{ - options = { - home = { - iconTheme = mkOption { - type = with types; nullOr iconThemeType; - default = null; - description = "The icon theme to use."; - }; - }; - }; - - config = - let - cfg = config.home.iconTheme; - in - mkIf (cfg != "null") { - gtk = mkIf config.gtk.enable (mkDefault { - iconTheme = { - inherit (cfg) name; - package = mkIf (cfg.package != "null") cfg.package; - }; - }); - - services.dunst = mkIf config.services.dunst.enable (mkDefault { - iconTheme = { - inherit (cfg) name; - package = mkIf (cfg.package != "null") cfg.package; - }; - }); - }; -} diff --git a/modules/home/options/theme/default.nix b/modules/home/options/theme/default.nix new file mode 100644 index 0000000..c785013 --- /dev/null +++ b/modules/home/options/theme/default.nix @@ -0,0 +1,122 @@ +{ + lib, + namespace, + config, + ... +}: +let + inherit (lib) + types + mkOption + literalMD + mkIf + mkDefault + ; + cfg = config.${namespace}.theme; + + colorThemes = lib.types.enum [ + "rose-pine" + ]; + + colorThemeType = types.submodule { + options = { + base = mkOption { + type = colorThemes; + example = "rose-pine"; + description = literalMD '' + The color theme to use. This should match the base of the enable + options provided by the input's module. For instance, the rose-pine + home-manager module provides the {option}`rose-pine.enable` base + option and the {option}`programs.gtk.rose-pine.enable` option. + ''; + }; + + flavor = mkOption { + type = with types; nullOr str; + default = null; + example = "moon"; + description = "The theme flavor to use, if applicable."; + }; + + accent = mkOption { + type = with types; nullOr str; + default = null; + example = "rose"; + description = "The theme accent to use, if applicable."; + }; + }; + }; + + mkColorThemeOpt = + mode: flavor: + (mkOption { + type = with types; either str colorThemeType; + default = { + base = "rose-pine"; + inherit flavor; + }; + description = "The color theme to use in ${mode} mode."; + }); + + # https://github.com/nix-community/home-manager/blob/master/modules/misc/gtk.nix + iconThemeType = types.submodule { + options = { + package = mkOption { + type = with types; nullOr package; + default = null; + example = "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 = with types; str; + example = "Adwaita"; + description = "The name of the icon theme within the package."; + }; + }; + }; +in +{ + options.${namespace}.theme = { + colors = rec { + default = mkOption { + type = with types; str; + default = "dark"; + description = "Whether to prefer the light or dark theme."; + }; + + light = mkColorThemeOpt "light" "dawn"; + dark = mkColorThemeOpt "dark" "main"; + + inherit ("${default}") base; + inherit ("${default}") flavor; + inherit ("${default}") accent; + }; + + icons = mkOption { + type = with types; nullOr iconThemeType; + default = null; + description = "The icon theme to use."; + }; + }; + + config = mkIf (cfg.icons != null) { + gtk = mkIf config.gtk.enable (mkDefault { + iconTheme = { + inherit (cfg.icons) name; + package = mkIf (cfg.icons.package != null) cfg.package; + }; + }); + + services.dunst = mkIf config.services.dunst.enable (mkDefault { + iconTheme = { + inherit (cfg.icons) name; + package = mkIf (cfg.icons.package != null) cfg.package; + }; + }); + }; +}