diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix index 6ceea41..a2ebcad 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -2,17 +2,19 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; + cfg = config.programs.alacritty.rose-pine; enable = cfg.enable && config.programs.alacritty.enable; -in { - options.programs.alacritty.rose-pine = lib.rp.mkRosePineOpt {name = "alacritty";}; + + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ + options.programs.alacritty.rose-pine = lib.rp.mkRosePineOpt { name = "alacritty"; }; config = lib.mkIf enable { - programs.alacritty.settings = - if (cfg.flavor == "main") - then lib.importTOML "${sources.alacritty}/dist/rose-pine.toml" - else lib.importTOML "${sources.alacritty}/dist/rose-pine-${cfg.flavor}.toml"; + programs.alacritty.settings = lib.importTOML "${sources.alacritty}/dist/${themeName}.toml"; }; } diff --git a/modules/home-manager/bat.nix b/modules/home-manager/bat.nix index 4253705..3f51b62 100644 --- a/modules/home-manager/bat.nix +++ b/modules/home-manager/bat.nix @@ -2,16 +2,17 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; + cfg = config.programs.bat.rose-pine; enable = cfg.enable && config.programs.bat.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { - options.programs.bat.rose-pine = lib.rp.mkRosePineOpt {name = "bat";}; + + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ + options.programs.bat.rose-pine = lib.rp.mkRosePineOpt { name = "bat"; }; config = lib.mkIf enable { programs.bat = { diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index 3af8ea0..1c116a6 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -2,19 +2,18 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.btop.rose-pine; enable = cfg.enable && config.programs.btop.enable; - themeFile = - if (cfg.flavor == "main") - then "rose-pine.theme" - else "rose-pine-${cfg.flavor}.theme"; + themeFile = "${lib.rp.getKebabTheme cfg.flavor}.theme"; themePath = "/${themeFile}"; theme = sources.btop + themePath; -in { - options.programs.btop.rose-pine = lib.rp.mkRosePineOpt {name = "btop";}; +in +{ + options.programs.btop.rose-pine = lib.rp.mkRosePineOpt { name = "btop"; }; config = lib.mkIf enable { xdg.configFile."btop/themes${themePath}".source = theme; diff --git a/modules/home-manager/cava.nix b/modules/home-manager/cava.nix index 5f50bbb..07e8e15 100644 --- a/modules/home-manager/cava.nix +++ b/modules/home-manager/cava.nix @@ -2,16 +2,17 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; + cfg = config.programs.cava.rose-pine; enable = cfg.enable && config.programs.cava.enable; - flavor = - if (cfg.flavor == "main") - then "rosepine" - else cfg.flavor; -in { - options.programs.cava.rose-pine = lib.rp.mkRosePineOpt {name = "cava";}; + + flavor = if (cfg.flavor == "main") then "rosepine" else cfg.flavor; +in +{ + options.programs.cava.rose-pine = lib.rp.mkRosePineOpt { name = "cava"; }; config.programs.cava = lib.mkIf enable { settings.color = lib.rp.fromINIRaw (sources.cava + "/${flavor}"); diff --git a/modules/home-manager/cursor.nix b/modules/home-manager/cursor.nix index 0384ef8..66ad9e7 100644 --- a/modules/home-manager/cursor.nix +++ b/modules/home-manager/cursor.nix @@ -3,14 +3,14 @@ pkgs, lib, ... -}: let +}: +let inherit (lib) rp mkIf; + cfg = config.rose-pine.pointerCursor; - flavor = - if (cfg.flavor == "dawn") - then "Dawn" - else ""; -in { + flavor = if (cfg.flavor == "dawn") then "Dawn" else ""; +in +{ options.rose-pine.pointerCursor = rp.mkRosePineOpt { name = "pointer cursors"; # NOTE: we exclude this from the global `rose-pine.enable` as there is no diff --git a/modules/home-manager/dunst.nix b/modules/home-manager/dunst.nix index 3cb3ab2..db8315b 100644 --- a/modules/home-manager/dunst.nix +++ b/modules/home-manager/dunst.nix @@ -2,24 +2,23 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; + cfg = config.services.dunst.rose-pine; enable = cfg.enable && config.services.dunst.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { - options.services.dunst.rose-pine = - lib.rp.mkRosePineOpt {name = "dunst";} - // { - prefix = lib.mkOption { - type = lib.types.str; - default = "00"; - description = "Prefix to use for the dunst drop-in file"; - }; + + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ + options.services.dunst.rose-pine = lib.rp.mkRosePineOpt { name = "dunst"; } // { + prefix = lib.mkOption { + type = lib.types.str; + default = "00"; + description = "Prefix to use for the dunst drop-in file"; }; + }; # Dunst currently has no "include" functionality, but has "drop-ins". # Unfortunately, this may cause inconvenience as it overrides @@ -28,7 +27,6 @@ in { # Using a prefix like this is necessary because drop-ins' precedence depends # on lexical order such that later drop-ins override earlier ones. # This way, users have better control over precedence. - "dunst/dunstrc.d/${cfg.prefix}-rose-pine.conf".source = - sources.dunst + "/${themeName}.conf"; + "dunst/dunstrc.d/${cfg.prefix}-rose-pine.conf".source = sources.dunst + "/${themeName}.conf"; }; } diff --git a/modules/home-manager/fcitx5.nix b/modules/home-manager/fcitx5.nix index a050ab1..ffa2fe1 100644 --- a/modules/home-manager/fcitx5.nix +++ b/modules/home-manager/fcitx5.nix @@ -2,27 +2,26 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; + cfg = config.i18n.inputMethod.fcitx5.rose-pine; enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5"; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { - options.i18n.inputMethod.fcitx5.rose-pine = - lib.rp.mkRosePineOpt {name = "Fcitx5";} - // { - apply = lib.mkOption { - type = lib.types.bool; - default = true; - description = '' - Applies the theme by overwriting `$XDG_CONFIG_HOME/fcitx5/conf/classicui.conf`. - If this is disabled, you must manually set the theme (e.g. by using `fcitx5-configtool`). - ''; - }; + + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ + options.i18n.inputMethod.fcitx5.rose-pine = lib.rp.mkRosePineOpt { name = "Fcitx5"; } // { + apply = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Applies the theme by overwriting `$XDG_CONFIG_HOME/fcitx5/conf/classicui.conf`. + If this is disabled, you must manually set the theme (e.g. by using `fcitx5-configtool`). + ''; }; + }; config = lib.mkIf enable { xdg.dataFile."fcitx5/themes/${themeName}" = { @@ -31,7 +30,7 @@ in { }; xdg.configFile."fcitx5/conf/classicui.conf" = lib.mkIf cfg.apply { - text = lib.generators.toINIWithGlobalSection {} { + text = lib.generators.toINIWithGlobalSection { } { globalSection.Theme = themeName; }; }; diff --git a/modules/home-manager/fish.nix b/modules/home-manager/fish.nix index c0a963e..c8f1ff8 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -2,18 +2,18 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; + cfg = config.programs.fish.rose-pine; enable = cfg.enable && config.programs.fish.enable; - themeName = - if (cfg.flavor == "main") - then "Rosé Pine" - else "Rosé Pine ${lib.rp.mkUpper cfg.flavor}"; + themeName = "Rosé Pine ${lib.rp.mkUpper (lib.rp.getFlavor cfg.flavor)}"; themePath = "/themes/${themeName}.theme"; -in { - options.programs.fish.rose-pine = lib.rp.mkRosePineOpt {name = "fish";}; +in +{ + options.programs.fish.rose-pine = lib.rp.mkRosePineOpt { name = "fish"; }; config = lib.mkIf enable { xdg.configFile."fish${themePath}".source = "${sources.fish}${themePath}"; diff --git a/modules/home-manager/foot.nix b/modules/home-manager/foot.nix index 76b56a5..6d51598 100644 --- a/modules/home-manager/foot.nix +++ b/modules/home-manager/foot.nix @@ -2,18 +2,17 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.foot.rose-pine; enable = cfg.enable && config.programs.foot.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { - options.programs.foot.rose-pine = lib.rp.mkRosePineOpt {name = "foot";}; + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ + options.programs.foot.rose-pine = lib.rp.mkRosePineOpt { name = "foot"; }; config.programs.foot = lib.mkIf enable { settings.main.include = sources.foot + "/${themeName}.ini"; diff --git a/modules/home-manager/fzf.nix b/modules/home-manager/fzf.nix index 8345628..892422e 100644 --- a/modules/home-manager/fzf.nix +++ b/modules/home-manager/fzf.nix @@ -2,36 +2,38 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; + cfg = config.programs.fzf.rose-pine; enable = cfg.enable && config.programs.fzf.enable; palette = (lib.importJSON "${sources.rose-pine-palette}/palette.json").${cfg.flavor}.colors; -in { - options.programs.fzf.rose-pine = - lib.rp.mkRosePineOpt {name = "fzf";}; +in +{ + options.programs.fzf.rose-pine = lib.rp.mkRosePineOpt { name = "fzf"; }; config.programs.fzf.colors = lib.mkIf enable - # Manually populate with colors from rose-pine/fzf - # The ordering is meant to match the order of rose-pine/fzf to make - # comparison easier - ( - lib.attrsets.mapAttrs (_: color: palette.${color}.hex) { - fg = "subtle"; - bg = "base"; - hl = "rose"; - "fg+" = "text"; - "bg+" = "overlay"; - "hl+" = "rose"; - border = "highlight-med"; - header = "pine"; - gutter = "base"; - spinner = "gold"; - info = "foam"; - pointer = "iris"; - marker = "love"; - prompt = "subtle"; - } - ); + # Manually populate with colors from rose-pine/fzf + # The ordering is meant to match the order of rose-pine/fzf to make + # comparison easier + ( + lib.attrsets.mapAttrs (_: color: palette.${color}.hex) { + fg = "subtle"; + bg = "base"; + hl = "rose"; + "fg+" = "text"; + "bg+" = "overlay"; + "hl+" = "rose"; + border = "highlight-med"; + header = "pine"; + gutter = "base"; + spinner = "gold"; + info = "foam"; + pointer = "iris"; + marker = "love"; + prompt = "subtle"; + } + ); } diff --git a/modules/home-manager/globals.nix b/modules/home-manager/globals.nix index e12cde0..e999cec 100644 --- a/modules/home-manager/globals.nix +++ b/modules/home-manager/globals.nix @@ -1,6 +1,7 @@ -{lib, ...}: { +{ lib, ... }: +{ config = { - assertions = [(lib.rp.assertMinimumVersion "24.05")]; + assertions = [ (lib.rp.assertMinimumVersion "24.05") ]; }; options.rose-pine = { @@ -18,9 +19,10 @@ description = "Global Rose Pine accent"; }; - sources = let - defaultSources = import ../../.sources; - in + sources = + let + defaultSources = import ../../.sources; + in lib.mkOption { type = lib.types.lazyAttrsOf lib.types.raw; default = defaultSources; diff --git a/modules/home-manager/gtk.nix b/modules/home-manager/gtk.nix index d40a64a..5dddaa9 100644 --- a/modules/home-manager/gtk.nix +++ b/modules/home-manager/gtk.nix @@ -3,21 +3,20 @@ pkgs, lib, ... -}: let - inherit - (lib) +}: +let + inherit (lib) rp mkIf mkMerge ; + cfg = config.gtk.rose-pine; enable = cfg.enable && config.gtk.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ options.gtk.rose-pine = rp.mkRosePineOpt { name = "gtk"; @@ -39,11 +38,13 @@ in { package = pkgs.rose-pine-gtk-theme; }; - xdg.configFile = let - gtk4Dir = "${config.gtk.theme.package}/share/themes/${themeName}/gtk-4.0"; - in { - "gtk-4.0/gtk.css".source = "${gtk4Dir}/gtk.css"; - }; + xdg.configFile = + let + gtk4Dir = "${config.gtk.theme.package}/share/themes/${themeName}/gtk-4.0"; + in + { + "gtk-4.0/gtk.css".source = "${gtk4Dir}/gtk.css"; + }; }) (mkIf cfg.icon.enable { diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix index 2a3f0e3..d7ec310 100644 --- a/modules/home-manager/helix.nix +++ b/modules/home-manager/helix.nix @@ -2,18 +2,17 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.helix.rose-pine; enable = cfg.enable && config.programs.helix.enable; - themeName = - if (cfg.flavor == "main") - then "rose_pine" - else "rose_pine_${cfg.flavor}"; -in { - options.programs.helix.rose-pine = lib.rp.mkRosePineOpt {name = "helix";}; + themeName = lib.rp.getSnakeTheme cfg.flavor; +in +{ + options.programs.helix.rose-pine = lib.rp.mkRosePineOpt { name = "helix"; }; config = lib.mkIf enable { programs.helix = { diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix index ba88057..1e3a837 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/hyprland.nix @@ -2,22 +2,19 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.wayland.windowManager.hyprland.rose-pine; enable = cfg.enable && config.wayland.windowManager.hyprland.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { - options.wayland.windowManager.hyprland.rose-pine = - lib.rp.mkRosePineOpt {name = "hyprland";} - // { - accent = lib.rp.mkAccentOpt "hyprland"; - }; + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ + options.wayland.windowManager.hyprland.rose-pine = lib.rp.mkRosePineOpt { name = "hyprland"; } // { + accent = lib.rp.mkAccentOpt "hyprland"; + }; config = lib.mkIf enable { wayland.windowManager.hyprland.settings = { diff --git a/modules/home-manager/k9s.nix b/modules/home-manager/k9s.nix index 06240e7..12b95ab 100644 --- a/modules/home-manager/k9s.nix +++ b/modules/home-manager/k9s.nix @@ -3,7 +3,8 @@ lib, pkgs, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.k9s.rose-pine; @@ -16,8 +17,9 @@ themeFile = "rose-pine.yaml"; themePath = "k9s/skins/${themeFile}"; theme = sources.k9s + "/skin.yml"; -in { - options.programs.k9s.rose-pine = lib.rp.mkRosePineOpt {name = "k9s";}; +in +{ + options.programs.k9s.rose-pine = lib.rp.mkRosePineOpt { name = "k9s"; }; config = lib.mkIf enable ( lib.mkMerge [ diff --git a/modules/home-manager/kitty.nix b/modules/home-manager/kitty.nix index eaa38bb..458a881 100644 --- a/modules/home-manager/kitty.nix +++ b/modules/home-manager/kitty.nix @@ -2,20 +2,19 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.kitty.rose-pine; enable = cfg.enable && config.programs.kitty.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; + themeName = lib.rp.getKebabTheme cfg.flavor; themePath = "themes/${themeName}.conf"; theme = sources.kitty + "/dist/${themeName}.conf"; -in { - options.programs.kitty.rose-pine = lib.rp.mkRosePineOpt {name = "kitty";}; +in +{ + options.programs.kitty.rose-pine = lib.rp.mkRosePineOpt { name = "kitty"; }; config = lib.mkIf enable { xdg.configFile."kitty/${themePath}".source = theme; diff --git a/modules/home-manager/mako.nix b/modules/home-manager/mako.nix index 3d0a1a9..23e1329 100644 --- a/modules/home-manager/mako.nix +++ b/modules/home-manager/mako.nix @@ -3,23 +3,21 @@ pkgs, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.services.mako.rose-pine; enable = cfg.enable && config.services.mako.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; + themeName = lib.rp.getKebabTheme cfg.flavor; theme = lib.rp.fromINI (sources.mako + "/theme/${themeName}.theme"); # Settings that need to be extracted and put in extraConfig - extraConfigAttrs = lib.attrsets.getAttrs ["urgency=high"] theme; -in { - options.services.mako.rose-pine = - lib.rp.mkRosePineOpt {name = "mako";}; + extraConfigAttrs = lib.attrsets.getAttrs [ "urgency=high" ] theme; +in +{ + options.services.mako.rose-pine = lib.rp.mkRosePineOpt { name = "mako"; }; # Will cause infinite recursion if config.services.mako is directly set as a # whole. @@ -29,7 +27,7 @@ in { borderColor = theme.border-color; progressColor = theme.progress-color; extraConfig = builtins.readFile ( - (pkgs.formats.ini {}).generate "mako-extra-config" extraConfigAttrs + (pkgs.formats.ini { }).generate "mako-extra-config" extraConfigAttrs ); }; } diff --git a/modules/home-manager/neovim.nix b/modules/home-manager/neovim.nix index 55da906..602c779 100644 --- a/modules/home-manager/neovim.nix +++ b/modules/home-manager/neovim.nix @@ -3,11 +3,13 @@ pkgs, lib, ... -}: let +}: +let cfg = config.programs.neovim.rose-pine; enable = cfg.enable && config.programs.neovim.enable; -in { - options.programs.neovim.rose-pine = lib.rp.mkRosePineOpt {name = "neovim";}; +in +{ + options.programs.neovim.rose-pine = lib.rp.mkRosePineOpt { name = "neovim"; }; config.programs.neovim = lib.mkIf enable { plugins = with pkgs.vimPlugins; [ diff --git a/modules/home-manager/polybar.nix b/modules/home-manager/polybar.nix index 5448943..19c76e7 100644 --- a/modules/home-manager/polybar.nix +++ b/modules/home-manager/polybar.nix @@ -2,18 +2,17 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.services.polybar.rose-pine; enable = cfg.enable && config.services.polybar.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { - options.services.polybar.rose-pine = lib.rp.mkRosePineOpt {name = "polybar";}; + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ + options.services.polybar.rose-pine = lib.rp.mkRosePineOpt { name = "polybar"; }; config.services.polybar.extraConfig = lib.mkIf enable ( builtins.readFile "${sources.polybar}/schemes/${themeName}.ini" diff --git a/modules/home-manager/rio.nix b/modules/home-manager/rio.nix index 86ca66d..6dbc8c2 100644 --- a/modules/home-manager/rio.nix +++ b/modules/home-manager/rio.nix @@ -2,18 +2,17 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.rio.rose-pine; enable = cfg.enable && config.programs.rio.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { - options.programs.rio.rose-pine = lib.rp.mkRosePineOpt {name = "rio";}; + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ + options.programs.rio.rose-pine = lib.rp.mkRosePineOpt { name = "rio"; }; config = lib.mkIf enable { programs.rio.settings = lib.importTOML "${sources.rio-terminal}/${themeName}.toml"; diff --git a/modules/home-manager/rofi.nix b/modules/home-manager/rofi.nix index bd5c2c3..7d5f49a 100644 --- a/modules/home-manager/rofi.nix +++ b/modules/home-manager/rofi.nix @@ -2,18 +2,17 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.rofi.rose-pine; enable = cfg.enable && config.programs.rofi.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { - options.programs.rofi.rose-pine = lib.rp.mkRosePineOpt {name = "rofi";}; + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ + options.programs.rofi.rose-pine = lib.rp.mkRosePineOpt { name = "rofi"; }; config.programs.rofi = lib.mkIf enable { theme = { diff --git a/modules/home-manager/starship.nix b/modules/home-manager/starship.nix index 99957a1..b57ed2b 100644 --- a/modules/home-manager/starship.nix +++ b/modules/home-manager/starship.nix @@ -2,18 +2,17 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.starship.rose-pine; enable = cfg.enable && config.programs.starship.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { - options.programs.starship.rose-pine = lib.rp.mkRosePineOpt {name = "starship";}; + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ + options.programs.starship.rose-pine = lib.rp.mkRosePineOpt { name = "starship"; }; config.programs.starship.settings = lib.mkIf enable ( lib.importTOML "${sources.starship}/${themeName}.toml" diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index 595ad4e..575518e 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -2,19 +2,17 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.wayland.windowManager.sway.rose-pine; enable = cfg.enable && config.wayland.windowManager.sway.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; - theme = "${sources.sway}/themes/${themeName}.theme"; -in { - options.wayland.windowManager.sway.rose-pine = lib.rp.mkRosePineOpt {name = "sway";}; + theme = "${sources.sway}/themes/${lib.rp.getKebabTheme cfg.flavor}.theme"; +in +{ + options.wayland.windowManager.sway.rose-pine = lib.rp.mkRosePineOpt { name = "sway"; }; config = lib.mkIf enable { wayland.windowManager.sway.extraConfigEarly = '' diff --git a/modules/home-manager/swaylock.nix b/modules/home-manager/swaylock.nix index 53131d2..83dfabd 100644 --- a/modules/home-manager/swaylock.nix +++ b/modules/home-manager/swaylock.nix @@ -2,21 +2,18 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.swaylock.rose-pine; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ options.programs.swaylock.rose-pine = { - enable = - lib.mkEnableOption "Rosé Pine theme" - // { - /* + enable = lib.mkEnableOption "Rosé Pine theme" // { + /* global `rose-pine.enable` purposefully doesn't work here in configurations with a `home.stateVersion` that is >= 23.05 @@ -33,14 +30,14 @@ in { debugging this was the most confusing and horrifying thing i've had to deal with throughout working on this project. - @getchoo - */ - default = lib.versionAtLeast config.home.stateVersion "23.05" && config.rose-pine.enable; - defaultText = lib.literalExpression '' - `rose-pine.enable` if `home.stateVersion` is >= 23.05, false otherwise. + */ + default = lib.versionAtLeast config.home.stateVersion "23.05" && config.rose-pine.enable; + defaultText = lib.literalExpression '' + `rose-pine.enable` if `home.stateVersion` is >= 23.05, false otherwise. - Yes this is weird, and there's a funny story about it in the code comments. - ''; - }; + Yes this is weird, and there's a funny story about it in the code comments. + ''; + }; flavor = lib.rp.mkFlavorOpt "swaylock"; }; diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix index 4bd9146..1c7f751 100644 --- a/modules/home-manager/tmux.nix +++ b/modules/home-manager/tmux.nix @@ -3,22 +3,22 @@ lib, pkgs, ... -}: let +}: +let cfg = config.programs.tmux.rose-pine; enable = cfg.enable && config.programs.tmux.enable; -in { - options.programs.tmux.rose-pine = - lib.rp.mkRosePineOpt {name = "tmux";} - // { - extraConfig = lib.mkOption { - type = lib.types.lines; - description = "Additional configuration for the rose-pine plugin."; - default = ""; - example = '' - set -g @rose-pine "application session user host date_time" - ''; - }; +in +{ + options.programs.tmux.rose-pine = lib.rp.mkRosePineOpt { name = "tmux"; } // { + extraConfig = lib.mkOption { + type = lib.types.lines; + description = "Additional configuration for the rose-pine plugin."; + default = ""; + example = '' + set -g @rose-pine "application session user host date_time" + ''; }; + }; config.programs.tmux.plugins = lib.mkIf enable [ { diff --git a/modules/home-manager/waybar.nix b/modules/home-manager/waybar.nix index 9e400c9..607d863 100644 --- a/modules/home-manager/waybar.nix +++ b/modules/home-manager/waybar.nix @@ -2,35 +2,31 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.waybar.rose-pine; enable = cfg.enable && config.programs.waybar.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; - styleFile = "${sources.waybar}/${themeName}.css"; -in { - options.programs.waybar.rose-pine = - lib.rp.mkRosePineOpt {name = "waybar";} - // { - mode = lib.mkOption { - type = lib.types.enum [ - "prependImport" - "createLink" - ]; - default = "prependImport"; - description = '' - Defines how to include the Rosé Pine theme css file: + styleFile = "${sources.waybar}/${lib.rp.getKebabTheme cfg.flavor}.css"; +in +{ + options.programs.waybar.rose-pine = lib.rp.mkRosePineOpt { name = "waybar"; } // { + mode = lib.mkOption { + type = lib.types.enum [ + "prependImport" + "createLink" + ]; + default = "prependImport"; + description = '' + Defines how to include the Rosé Pine theme css file: - - `prependImport`: Prepends the import statement, if `programs.waybar.style` is a string (with default override priority). - - `createLink`: Creates a symbolic link `~/.config/waybar/rose-pine.css`, which needs to be included in the waybar stylesheet. - ''; - }; + - `prependImport`: Prepends the import statement, if `programs.waybar.style` is a string (with default override priority). + - `createLink`: Creates a symbolic link `~/.config/waybar/rose-pine.css`, which needs to be included in the waybar stylesheet. + ''; }; + }; config = lib.mkIf enable ( lib.mkMerge [ diff --git a/modules/home-manager/zathura.nix b/modules/home-manager/zathura.nix index cb9f4ab..20c187b 100644 --- a/modules/home-manager/zathura.nix +++ b/modules/home-manager/zathura.nix @@ -2,18 +2,17 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.zathura.rose-pine; enable = cfg.enable && config.programs.zathura.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; -in { - options.programs.zathura.rose-pine = lib.rp.mkRosePineOpt {name = "zathura";}; + themeName = lib.rp.getKebabTheme cfg.flavor; +in +{ + options.programs.zathura.rose-pine = lib.rp.mkRosePineOpt { name = "zathura"; }; config.programs.zathura.extraConfig = lib.mkIf enable '' include ${sources.zathura + "/${themeName}"} diff --git a/modules/home-manager/zellij.nix b/modules/home-manager/zellij.nix index 4b5ac5f..e3c2954 100644 --- a/modules/home-manager/zellij.nix +++ b/modules/home-manager/zellij.nix @@ -2,19 +2,18 @@ config, lib, ... -}: let +}: +let inherit (config.rose-pine) sources; cfg = config.programs.zellij.rose-pine; enable = cfg.enable && config.programs.zellij.enable; - themeName = - if (cfg.flavor == "main") - then "rose-pine" - else "rose-pine-${cfg.flavor}"; + themeName = lib.rp.getKebabTheme cfg.flavor; theme = sources.zellij + "/dist/${themeName}.kdl"; -in { - options.programs.zellij.rose-pine = lib.rp.mkRosePineOpt {name = "zellij";}; +in +{ + options.programs.zellij.rose-pine = lib.rp.mkRosePineOpt { name = "zellij"; }; config = lib.mkIf enable { xdg.configFile."zellij/themes/${themeName}.kdl".source = theme;