refactor(home): Use new helpers; formatting

This commit is contained in:
punkfairie 2024-11-04 20:55:40 -08:00
parent 2efe270e71
commit ebc1dbcd69
Signed by: punkfairie
GPG key ID: 01823C057725C266
28 changed files with 254 additions and 268 deletions

View file

@ -2,17 +2,19 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.alacritty.rose-pine; cfg = config.programs.alacritty.rose-pine;
enable = cfg.enable && config.programs.alacritty.enable; 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 { config = lib.mkIf enable {
programs.alacritty.settings = programs.alacritty.settings = lib.importTOML "${sources.alacritty}/dist/${themeName}.toml";
if (cfg.flavor == "main")
then lib.importTOML "${sources.alacritty}/dist/rose-pine.toml"
else lib.importTOML "${sources.alacritty}/dist/rose-pine-${cfg.flavor}.toml";
}; };
} }

View file

@ -2,16 +2,17 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.bat.rose-pine; cfg = config.programs.bat.rose-pine;
enable = cfg.enable && config.programs.bat.enable; enable = cfg.enable && config.programs.bat.enable;
themeName =
if (cfg.flavor == "main") themeName = lib.rp.getKebabTheme cfg.flavor;
then "rose-pine" in
else "rose-pine-${cfg.flavor}"; {
in { options.programs.bat.rose-pine = lib.rp.mkRosePineOpt { name = "bat"; };
options.programs.bat.rose-pine = lib.rp.mkRosePineOpt {name = "bat";};
config = lib.mkIf enable { config = lib.mkIf enable {
programs.bat = { programs.bat = {

View file

@ -2,19 +2,18 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.btop.rose-pine; cfg = config.programs.btop.rose-pine;
enable = cfg.enable && config.programs.btop.enable; enable = cfg.enable && config.programs.btop.enable;
themeFile = themeFile = "${lib.rp.getKebabTheme cfg.flavor}.theme";
if (cfg.flavor == "main")
then "rose-pine.theme"
else "rose-pine-${cfg.flavor}.theme";
themePath = "/${themeFile}"; themePath = "/${themeFile}";
theme = sources.btop + themePath; theme = sources.btop + themePath;
in { in
options.programs.btop.rose-pine = lib.rp.mkRosePineOpt {name = "btop";}; {
options.programs.btop.rose-pine = lib.rp.mkRosePineOpt { name = "btop"; };
config = lib.mkIf enable { config = lib.mkIf enable {
xdg.configFile."btop/themes${themePath}".source = theme; xdg.configFile."btop/themes${themePath}".source = theme;

View file

@ -2,16 +2,17 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.cava.rose-pine; cfg = config.programs.cava.rose-pine;
enable = cfg.enable && config.programs.cava.enable; enable = cfg.enable && config.programs.cava.enable;
flavor =
if (cfg.flavor == "main") flavor = if (cfg.flavor == "main") then "rosepine" else cfg.flavor;
then "rosepine" in
else cfg.flavor; {
in { options.programs.cava.rose-pine = lib.rp.mkRosePineOpt { name = "cava"; };
options.programs.cava.rose-pine = lib.rp.mkRosePineOpt {name = "cava";};
config.programs.cava = lib.mkIf enable { config.programs.cava = lib.mkIf enable {
settings.color = lib.rp.fromINIRaw (sources.cava + "/${flavor}"); settings.color = lib.rp.fromINIRaw (sources.cava + "/${flavor}");

View file

@ -3,14 +3,14 @@
pkgs, pkgs,
lib, lib,
... ...
}: let }:
let
inherit (lib) rp mkIf; inherit (lib) rp mkIf;
cfg = config.rose-pine.pointerCursor; cfg = config.rose-pine.pointerCursor;
flavor = flavor = if (cfg.flavor == "dawn") then "Dawn" else "";
if (cfg.flavor == "dawn") in
then "Dawn" {
else "";
in {
options.rose-pine.pointerCursor = rp.mkRosePineOpt { options.rose-pine.pointerCursor = rp.mkRosePineOpt {
name = "pointer cursors"; name = "pointer cursors";
# NOTE: we exclude this from the global `rose-pine.enable` as there is no # NOTE: we exclude this from the global `rose-pine.enable` as there is no

View file

@ -2,24 +2,23 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.services.dunst.rose-pine; cfg = config.services.dunst.rose-pine;
enable = cfg.enable && config.services.dunst.enable; enable = cfg.enable && config.services.dunst.enable;
themeName =
if (cfg.flavor == "main") themeName = lib.rp.getKebabTheme cfg.flavor;
then "rose-pine" in
else "rose-pine-${cfg.flavor}"; {
in { options.services.dunst.rose-pine = lib.rp.mkRosePineOpt { name = "dunst"; } // {
options.services.dunst.rose-pine = prefix = lib.mkOption {
lib.rp.mkRosePineOpt {name = "dunst";} type = lib.types.str;
// { default = "00";
prefix = lib.mkOption { description = "Prefix to use for the dunst drop-in file";
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". # Dunst currently has no "include" functionality, but has "drop-ins".
# Unfortunately, this may cause inconvenience as it overrides # 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 # Using a prefix like this is necessary because drop-ins' precedence depends
# on lexical order such that later drop-ins override earlier ones. # on lexical order such that later drop-ins override earlier ones.
# This way, users have better control over precedence. # This way, users have better control over precedence.
"dunst/dunstrc.d/${cfg.prefix}-rose-pine.conf".source = "dunst/dunstrc.d/${cfg.prefix}-rose-pine.conf".source = sources.dunst + "/${themeName}.conf";
sources.dunst + "/${themeName}.conf";
}; };
} }

View file

@ -2,27 +2,26 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.i18n.inputMethod.fcitx5.rose-pine; cfg = config.i18n.inputMethod.fcitx5.rose-pine;
enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5"; enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5";
themeName =
if (cfg.flavor == "main") themeName = lib.rp.getKebabTheme cfg.flavor;
then "rose-pine" in
else "rose-pine-${cfg.flavor}"; {
in { options.i18n.inputMethod.fcitx5.rose-pine = lib.rp.mkRosePineOpt { name = "Fcitx5"; } // {
options.i18n.inputMethod.fcitx5.rose-pine = apply = lib.mkOption {
lib.rp.mkRosePineOpt {name = "Fcitx5";} type = lib.types.bool;
// { default = true;
apply = lib.mkOption { description = ''
type = lib.types.bool; Applies the theme by overwriting `$XDG_CONFIG_HOME/fcitx5/conf/classicui.conf`.
default = true; If this is disabled, you must manually set the theme (e.g. by using `fcitx5-configtool`).
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 { config = lib.mkIf enable {
xdg.dataFile."fcitx5/themes/${themeName}" = { xdg.dataFile."fcitx5/themes/${themeName}" = {
@ -31,7 +30,7 @@ in {
}; };
xdg.configFile."fcitx5/conf/classicui.conf" = lib.mkIf cfg.apply { xdg.configFile."fcitx5/conf/classicui.conf" = lib.mkIf cfg.apply {
text = lib.generators.toINIWithGlobalSection {} { text = lib.generators.toINIWithGlobalSection { } {
globalSection.Theme = themeName; globalSection.Theme = themeName;
}; };
}; };

View file

@ -2,18 +2,18 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.fish.rose-pine; cfg = config.programs.fish.rose-pine;
enable = cfg.enable && config.programs.fish.enable; enable = cfg.enable && config.programs.fish.enable;
themeName = themeName = "Rosé Pine ${lib.rp.mkUpper (lib.rp.getFlavor cfg.flavor)}";
if (cfg.flavor == "main")
then "Rosé Pine"
else "Rosé Pine ${lib.rp.mkUpper cfg.flavor}";
themePath = "/themes/${themeName}.theme"; themePath = "/themes/${themeName}.theme";
in { in
options.programs.fish.rose-pine = lib.rp.mkRosePineOpt {name = "fish";}; {
options.programs.fish.rose-pine = lib.rp.mkRosePineOpt { name = "fish"; };
config = lib.mkIf enable { config = lib.mkIf enable {
xdg.configFile."fish${themePath}".source = "${sources.fish}${themePath}"; xdg.configFile."fish${themePath}".source = "${sources.fish}${themePath}";

View file

@ -2,18 +2,17 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.foot.rose-pine; cfg = config.programs.foot.rose-pine;
enable = cfg.enable && config.programs.foot.enable; enable = cfg.enable && config.programs.foot.enable;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main") in
then "rose-pine" {
else "rose-pine-${cfg.flavor}"; options.programs.foot.rose-pine = lib.rp.mkRosePineOpt { name = "foot"; };
in {
options.programs.foot.rose-pine = lib.rp.mkRosePineOpt {name = "foot";};
config.programs.foot = lib.mkIf enable { config.programs.foot = lib.mkIf enable {
settings.main.include = sources.foot + "/${themeName}.ini"; settings.main.include = sources.foot + "/${themeName}.ini";

View file

@ -2,36 +2,38 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.fzf.rose-pine; cfg = config.programs.fzf.rose-pine;
enable = cfg.enable && config.programs.fzf.enable; enable = cfg.enable && config.programs.fzf.enable;
palette = (lib.importJSON "${sources.rose-pine-palette}/palette.json").${cfg.flavor}.colors; palette = (lib.importJSON "${sources.rose-pine-palette}/palette.json").${cfg.flavor}.colors;
in { in
options.programs.fzf.rose-pine = {
lib.rp.mkRosePineOpt {name = "fzf";}; options.programs.fzf.rose-pine = lib.rp.mkRosePineOpt { name = "fzf"; };
config.programs.fzf.colors = config.programs.fzf.colors =
lib.mkIf enable lib.mkIf enable
# Manually populate with colors from rose-pine/fzf # Manually populate with colors from rose-pine/fzf
# The ordering is meant to match the order of rose-pine/fzf to make # The ordering is meant to match the order of rose-pine/fzf to make
# comparison easier # comparison easier
( (
lib.attrsets.mapAttrs (_: color: palette.${color}.hex) { lib.attrsets.mapAttrs (_: color: palette.${color}.hex) {
fg = "subtle"; fg = "subtle";
bg = "base"; bg = "base";
hl = "rose"; hl = "rose";
"fg+" = "text"; "fg+" = "text";
"bg+" = "overlay"; "bg+" = "overlay";
"hl+" = "rose"; "hl+" = "rose";
border = "highlight-med"; border = "highlight-med";
header = "pine"; header = "pine";
gutter = "base"; gutter = "base";
spinner = "gold"; spinner = "gold";
info = "foam"; info = "foam";
pointer = "iris"; pointer = "iris";
marker = "love"; marker = "love";
prompt = "subtle"; prompt = "subtle";
} }
); );
} }

View file

@ -1,6 +1,7 @@
{lib, ...}: { { lib, ... }:
{
config = { config = {
assertions = [(lib.rp.assertMinimumVersion "24.05")]; assertions = [ (lib.rp.assertMinimumVersion "24.05") ];
}; };
options.rose-pine = { options.rose-pine = {
@ -18,9 +19,10 @@
description = "Global Rose Pine accent"; description = "Global Rose Pine accent";
}; };
sources = let sources =
defaultSources = import ../../.sources; let
in defaultSources = import ../../.sources;
in
lib.mkOption { lib.mkOption {
type = lib.types.lazyAttrsOf lib.types.raw; type = lib.types.lazyAttrsOf lib.types.raw;
default = defaultSources; default = defaultSources;

View file

@ -3,21 +3,20 @@
pkgs, pkgs,
lib, lib,
... ...
}: let }:
inherit let
(lib) inherit (lib)
rp rp
mkIf mkIf
mkMerge mkMerge
; ;
cfg = config.gtk.rose-pine; cfg = config.gtk.rose-pine;
enable = cfg.enable && config.gtk.enable; enable = cfg.enable && config.gtk.enable;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main") in
then "rose-pine" {
else "rose-pine-${cfg.flavor}";
in {
options.gtk.rose-pine = options.gtk.rose-pine =
rp.mkRosePineOpt { rp.mkRosePineOpt {
name = "gtk"; name = "gtk";
@ -39,11 +38,13 @@ in {
package = pkgs.rose-pine-gtk-theme; package = pkgs.rose-pine-gtk-theme;
}; };
xdg.configFile = let xdg.configFile =
gtk4Dir = "${config.gtk.theme.package}/share/themes/${themeName}/gtk-4.0"; let
in { gtk4Dir = "${config.gtk.theme.package}/share/themes/${themeName}/gtk-4.0";
"gtk-4.0/gtk.css".source = "${gtk4Dir}/gtk.css"; in
}; {
"gtk-4.0/gtk.css".source = "${gtk4Dir}/gtk.css";
};
}) })
(mkIf cfg.icon.enable { (mkIf cfg.icon.enable {

View file

@ -2,18 +2,17 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.helix.rose-pine; cfg = config.programs.helix.rose-pine;
enable = cfg.enable && config.programs.helix.enable; enable = cfg.enable && config.programs.helix.enable;
themeName = themeName = lib.rp.getSnakeTheme cfg.flavor;
if (cfg.flavor == "main") in
then "rose_pine" {
else "rose_pine_${cfg.flavor}"; options.programs.helix.rose-pine = lib.rp.mkRosePineOpt { name = "helix"; };
in {
options.programs.helix.rose-pine = lib.rp.mkRosePineOpt {name = "helix";};
config = lib.mkIf enable { config = lib.mkIf enable {
programs.helix = { programs.helix = {

View file

@ -2,22 +2,19 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.wayland.windowManager.hyprland.rose-pine; cfg = config.wayland.windowManager.hyprland.rose-pine;
enable = cfg.enable && config.wayland.windowManager.hyprland.enable; enable = cfg.enable && config.wayland.windowManager.hyprland.enable;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main") in
then "rose-pine" {
else "rose-pine-${cfg.flavor}"; options.wayland.windowManager.hyprland.rose-pine = lib.rp.mkRosePineOpt { name = "hyprland"; } // {
in { accent = lib.rp.mkAccentOpt "hyprland";
options.wayland.windowManager.hyprland.rose-pine = };
lib.rp.mkRosePineOpt {name = "hyprland";}
// {
accent = lib.rp.mkAccentOpt "hyprland";
};
config = lib.mkIf enable { config = lib.mkIf enable {
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {

View file

@ -3,7 +3,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.k9s.rose-pine; cfg = config.programs.k9s.rose-pine;
@ -16,8 +17,9 @@
themeFile = "rose-pine.yaml"; themeFile = "rose-pine.yaml";
themePath = "k9s/skins/${themeFile}"; themePath = "k9s/skins/${themeFile}";
theme = sources.k9s + "/skin.yml"; theme = sources.k9s + "/skin.yml";
in { in
options.programs.k9s.rose-pine = lib.rp.mkRosePineOpt {name = "k9s";}; {
options.programs.k9s.rose-pine = lib.rp.mkRosePineOpt { name = "k9s"; };
config = lib.mkIf enable ( config = lib.mkIf enable (
lib.mkMerge [ lib.mkMerge [

View file

@ -2,20 +2,19 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.kitty.rose-pine; cfg = config.programs.kitty.rose-pine;
enable = cfg.enable && config.programs.kitty.enable; enable = cfg.enable && config.programs.kitty.enable;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main")
then "rose-pine"
else "rose-pine-${cfg.flavor}";
themePath = "themes/${themeName}.conf"; themePath = "themes/${themeName}.conf";
theme = sources.kitty + "/dist/${themeName}.conf"; theme = sources.kitty + "/dist/${themeName}.conf";
in { in
options.programs.kitty.rose-pine = lib.rp.mkRosePineOpt {name = "kitty";}; {
options.programs.kitty.rose-pine = lib.rp.mkRosePineOpt { name = "kitty"; };
config = lib.mkIf enable { config = lib.mkIf enable {
xdg.configFile."kitty/${themePath}".source = theme; xdg.configFile."kitty/${themePath}".source = theme;

View file

@ -3,23 +3,21 @@
pkgs, pkgs,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.services.mako.rose-pine; cfg = config.services.mako.rose-pine;
enable = cfg.enable && config.services.mako.enable; enable = cfg.enable && config.services.mako.enable;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main")
then "rose-pine"
else "rose-pine-${cfg.flavor}";
theme = lib.rp.fromINI (sources.mako + "/theme/${themeName}.theme"); theme = lib.rp.fromINI (sources.mako + "/theme/${themeName}.theme");
# Settings that need to be extracted and put in extraConfig # Settings that need to be extracted and put in extraConfig
extraConfigAttrs = lib.attrsets.getAttrs ["urgency=high"] theme; extraConfigAttrs = lib.attrsets.getAttrs [ "urgency=high" ] theme;
in { in
options.services.mako.rose-pine = {
lib.rp.mkRosePineOpt {name = "mako";}; options.services.mako.rose-pine = lib.rp.mkRosePineOpt { name = "mako"; };
# Will cause infinite recursion if config.services.mako is directly set as a # Will cause infinite recursion if config.services.mako is directly set as a
# whole. # whole.
@ -29,7 +27,7 @@ in {
borderColor = theme.border-color; borderColor = theme.border-color;
progressColor = theme.progress-color; progressColor = theme.progress-color;
extraConfig = builtins.readFile ( extraConfig = builtins.readFile (
(pkgs.formats.ini {}).generate "mako-extra-config" extraConfigAttrs (pkgs.formats.ini { }).generate "mako-extra-config" extraConfigAttrs
); );
}; };
} }

View file

@ -3,11 +3,13 @@
pkgs, pkgs,
lib, lib,
... ...
}: let }:
let
cfg = config.programs.neovim.rose-pine; cfg = config.programs.neovim.rose-pine;
enable = cfg.enable && config.programs.neovim.enable; enable = cfg.enable && config.programs.neovim.enable;
in { in
options.programs.neovim.rose-pine = lib.rp.mkRosePineOpt {name = "neovim";}; {
options.programs.neovim.rose-pine = lib.rp.mkRosePineOpt { name = "neovim"; };
config.programs.neovim = lib.mkIf enable { config.programs.neovim = lib.mkIf enable {
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [

View file

@ -2,18 +2,17 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.services.polybar.rose-pine; cfg = config.services.polybar.rose-pine;
enable = cfg.enable && config.services.polybar.enable; enable = cfg.enable && config.services.polybar.enable;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main") in
then "rose-pine" {
else "rose-pine-${cfg.flavor}"; options.services.polybar.rose-pine = lib.rp.mkRosePineOpt { name = "polybar"; };
in {
options.services.polybar.rose-pine = lib.rp.mkRosePineOpt {name = "polybar";};
config.services.polybar.extraConfig = lib.mkIf enable ( config.services.polybar.extraConfig = lib.mkIf enable (
builtins.readFile "${sources.polybar}/schemes/${themeName}.ini" builtins.readFile "${sources.polybar}/schemes/${themeName}.ini"

View file

@ -2,18 +2,17 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.rio.rose-pine; cfg = config.programs.rio.rose-pine;
enable = cfg.enable && config.programs.rio.enable; enable = cfg.enable && config.programs.rio.enable;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main") in
then "rose-pine" {
else "rose-pine-${cfg.flavor}"; options.programs.rio.rose-pine = lib.rp.mkRosePineOpt { name = "rio"; };
in {
options.programs.rio.rose-pine = lib.rp.mkRosePineOpt {name = "rio";};
config = lib.mkIf enable { config = lib.mkIf enable {
programs.rio.settings = lib.importTOML "${sources.rio-terminal}/${themeName}.toml"; programs.rio.settings = lib.importTOML "${sources.rio-terminal}/${themeName}.toml";

View file

@ -2,18 +2,17 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.rofi.rose-pine; cfg = config.programs.rofi.rose-pine;
enable = cfg.enable && config.programs.rofi.enable; enable = cfg.enable && config.programs.rofi.enable;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main") in
then "rose-pine" {
else "rose-pine-${cfg.flavor}"; options.programs.rofi.rose-pine = lib.rp.mkRosePineOpt { name = "rofi"; };
in {
options.programs.rofi.rose-pine = lib.rp.mkRosePineOpt {name = "rofi";};
config.programs.rofi = lib.mkIf enable { config.programs.rofi = lib.mkIf enable {
theme = { theme = {

View file

@ -2,18 +2,17 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.starship.rose-pine; cfg = config.programs.starship.rose-pine;
enable = cfg.enable && config.programs.starship.enable; enable = cfg.enable && config.programs.starship.enable;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main") in
then "rose-pine" {
else "rose-pine-${cfg.flavor}"; options.programs.starship.rose-pine = lib.rp.mkRosePineOpt { name = "starship"; };
in {
options.programs.starship.rose-pine = lib.rp.mkRosePineOpt {name = "starship";};
config.programs.starship.settings = lib.mkIf enable ( config.programs.starship.settings = lib.mkIf enable (
lib.importTOML "${sources.starship}/${themeName}.toml" lib.importTOML "${sources.starship}/${themeName}.toml"

View file

@ -2,19 +2,17 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.wayland.windowManager.sway.rose-pine; cfg = config.wayland.windowManager.sway.rose-pine;
enable = cfg.enable && config.wayland.windowManager.sway.enable; enable = cfg.enable && config.wayland.windowManager.sway.enable;
themeName = theme = "${sources.sway}/themes/${lib.rp.getKebabTheme cfg.flavor}.theme";
if (cfg.flavor == "main") in
then "rose-pine" {
else "rose-pine-${cfg.flavor}"; options.wayland.windowManager.sway.rose-pine = lib.rp.mkRosePineOpt { name = "sway"; };
theme = "${sources.sway}/themes/${themeName}.theme";
in {
options.wayland.windowManager.sway.rose-pine = lib.rp.mkRosePineOpt {name = "sway";};
config = lib.mkIf enable { config = lib.mkIf enable {
wayland.windowManager.sway.extraConfigEarly = '' wayland.windowManager.sway.extraConfigEarly = ''

View file

@ -2,21 +2,18 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.swaylock.rose-pine; cfg = config.programs.swaylock.rose-pine;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main") in
then "rose-pine" {
else "rose-pine-${cfg.flavor}";
in {
options.programs.swaylock.rose-pine = { options.programs.swaylock.rose-pine = {
enable = enable = lib.mkEnableOption "Rosé Pine theme" // {
lib.mkEnableOption "Rosé Pine theme" /*
// {
/*
global `rose-pine.enable` purposefully doesn't work here in global `rose-pine.enable` purposefully doesn't work here in
configurations with a `home.stateVersion` that is >= 23.05 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 debugging this was the most confusing and horrifying thing i've had to
deal with throughout working on this project. deal with throughout working on this project.
- @getchoo - @getchoo
*/ */
default = lib.versionAtLeast config.home.stateVersion "23.05" && config.rose-pine.enable; default = lib.versionAtLeast config.home.stateVersion "23.05" && config.rose-pine.enable;
defaultText = lib.literalExpression '' defaultText = lib.literalExpression ''
`rose-pine.enable` if `home.stateVersion` is >= 23.05, false otherwise. `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"; flavor = lib.rp.mkFlavorOpt "swaylock";
}; };

View file

@ -3,22 +3,22 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.programs.tmux.rose-pine; cfg = config.programs.tmux.rose-pine;
enable = cfg.enable && config.programs.tmux.enable; enable = cfg.enable && config.programs.tmux.enable;
in { in
options.programs.tmux.rose-pine = {
lib.rp.mkRosePineOpt {name = "tmux";} options.programs.tmux.rose-pine = lib.rp.mkRosePineOpt { name = "tmux"; } // {
// { extraConfig = lib.mkOption {
extraConfig = lib.mkOption { type = lib.types.lines;
type = lib.types.lines; description = "Additional configuration for the rose-pine plugin.";
description = "Additional configuration for the rose-pine plugin."; default = "";
default = ""; example = ''
example = '' set -g @rose-pine "application session user host date_time"
set -g @rose-pine "application session user host date_time" '';
'';
};
}; };
};
config.programs.tmux.plugins = lib.mkIf enable [ config.programs.tmux.plugins = lib.mkIf enable [
{ {

View file

@ -2,35 +2,31 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.waybar.rose-pine; cfg = config.programs.waybar.rose-pine;
enable = cfg.enable && config.programs.waybar.enable; enable = cfg.enable && config.programs.waybar.enable;
themeName = styleFile = "${sources.waybar}/${lib.rp.getKebabTheme cfg.flavor}.css";
if (cfg.flavor == "main") in
then "rose-pine" {
else "rose-pine-${cfg.flavor}"; options.programs.waybar.rose-pine = lib.rp.mkRosePineOpt { name = "waybar"; } // {
styleFile = "${sources.waybar}/${themeName}.css"; mode = lib.mkOption {
in { type = lib.types.enum [
options.programs.waybar.rose-pine = "prependImport"
lib.rp.mkRosePineOpt {name = "waybar";} "createLink"
// { ];
mode = lib.mkOption { default = "prependImport";
type = lib.types.enum [ description = ''
"prependImport" Defines how to include the Rosé Pine theme css file:
"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). - `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. - `createLink`: Creates a symbolic link `~/.config/waybar/rose-pine.css`, which needs to be included in the waybar stylesheet.
''; '';
};
}; };
};
config = lib.mkIf enable ( config = lib.mkIf enable (
lib.mkMerge [ lib.mkMerge [

View file

@ -2,18 +2,17 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.zathura.rose-pine; cfg = config.programs.zathura.rose-pine;
enable = cfg.enable && config.programs.zathura.enable; enable = cfg.enable && config.programs.zathura.enable;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main") in
then "rose-pine" {
else "rose-pine-${cfg.flavor}"; options.programs.zathura.rose-pine = lib.rp.mkRosePineOpt { name = "zathura"; };
in {
options.programs.zathura.rose-pine = lib.rp.mkRosePineOpt {name = "zathura";};
config.programs.zathura.extraConfig = lib.mkIf enable '' config.programs.zathura.extraConfig = lib.mkIf enable ''
include ${sources.zathura + "/${themeName}"} include ${sources.zathura + "/${themeName}"}

View file

@ -2,19 +2,18 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (config.rose-pine) sources; inherit (config.rose-pine) sources;
cfg = config.programs.zellij.rose-pine; cfg = config.programs.zellij.rose-pine;
enable = cfg.enable && config.programs.zellij.enable; enable = cfg.enable && config.programs.zellij.enable;
themeName = themeName = lib.rp.getKebabTheme cfg.flavor;
if (cfg.flavor == "main")
then "rose-pine"
else "rose-pine-${cfg.flavor}";
theme = sources.zellij + "/dist/${themeName}.kdl"; theme = sources.zellij + "/dist/${themeName}.kdl";
in { in
options.programs.zellij.rose-pine = lib.rp.mkRosePineOpt {name = "zellij";}; {
options.programs.zellij.rose-pine = lib.rp.mkRosePineOpt { name = "zellij"; };
config = lib.mkIf enable { config = lib.mkIf enable {
xdg.configFile."zellij/themes/${themeName}.kdl".source = theme; xdg.configFile."zellij/themes/${themeName}.kdl".source = theme;