Compare commits

...

11 commits

Author SHA1 Message Date
f26b1be83f
refactor(nixos): Use new helpers; formatting
Some checks are pending
CI / Format Nix files (push) Waiting to run
CI / Test Modules (push) Waiting to run
CI / Validate sources (push) Waiting to run
Release / Make release (push) Waiting to run
Release / Publish to Flake registries (push) Blocked by required conditions
Build & deploy website / Build site (push) Waiting to run
Build & deploy website / Deploy website (push) Blocked by required conditions
2024-11-04 20:57:54 -08:00
ebc1dbcd69
refactor(home): Use new helpers; formatting 2024-11-04 20:57:54 -08:00
2efe270e71
feat(lib): Add snake case helper fn 2024-11-04 20:57:54 -08:00
80b67d9d9e
fix(lib): Fix parens 2024-11-04 20:57:54 -08:00
0f2722c5f7
feat(lib): Add helper fns to handle theme naming
Rose Pine names the default theme flavor something like "Rose Pine", and
when a theme needs to be kebab case that requires extra logic to avoid a
hanging - when the main flavor is selected.
2024-11-04 20:57:54 -08:00
91374e5df4
chore(starship): mkDefault caused entire config to be overridden
Revert " feat(starship): Starship fixes"

This reverts commit 4ce7b95d1b.
2024-11-04 20:57:49 -08:00
3456fea6f1
feat(starship): Starship fixes 2024-11-04 20:57:45 -08:00
545ec1afe7
chore(wezterm): Too complicated to configure
Revert " test(wezterm): Add to testing"

This reverts commit 1fb54d67ae.
2024-11-04 20:57:41 -08:00
9064f1348c
test(wezterm): Add to testing 2024-11-04 20:57:36 -08:00
870f2fe63e
feat(wezterm): Add Wezterm config
This config does require the user to format their configuration in a
specific way:
```lua
local config = wezterm.config_builder()

-- config here...

return config
```

Since this is the format that the official documentation uses in
examples, most users probably follow suit. But worth pointing out
regardless.
2024-11-04 20:57:30 -08:00
f1f4b581d9
ci(just): Add justfile 2024-11-04 20:57:20 -08:00
34 changed files with 350 additions and 323 deletions

5
Justfile Normal file
View file

@ -0,0 +1,5 @@
test:
nix run \
--inputs-from "./dev" "github:Mic92/nix-fast-build" -- \
--no-nom \
--flake "./dev#checks$(nix eval --raw --impure --expr builtins.currentSystem)"

View file

@ -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";
};
}

View file

@ -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 = {

View file

@ -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;

View file

@ -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}");

View file

@ -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

View file

@ -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";
};
}

View file

@ -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;
};
};

View file

@ -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}";

View file

@ -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";

View file

@ -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";
}
);
}

View file

@ -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;

View file

@ -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 {

View file

@ -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 = {

View file

@ -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 = {

View file

@ -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 [

View file

@ -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;

View file

@ -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
);
};
}

View file

@ -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; [

View file

@ -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"

View file

@ -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";

View file

@ -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 = {

View file

@ -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"

View file

@ -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 = ''

View file

@ -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";
};

View file

@ -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 [
{

View file

@ -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 [

View file

@ -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}"}

View file

@ -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;

View file

@ -3,17 +3,20 @@
lib,
pkgs,
...
}: let
}:
let
# this is a recursive attribute with all the functions below
inherit (lib) rp;
in {
in
{
# string -> type -> string -> a
# this is an internal function and shouldn't be
# used unless you know what you're doing. it takes
# a string (the name of the property, i.e., flavor
# or accent), the type of the property, the name of
# the module, followed by local config attrset
mkBasicOpt = attr: type: name:
mkBasicOpt =
attr: type: name:
lib.mkOption {
inherit type;
default = config.rose-pine.${attr};
@ -42,47 +45,70 @@ in {
];
};
# string -> string
# this returns a blank string when string == "main",
# because Rose Pine names the default flavor rose pine
getFlavor = flavor: (if flavor == "main" then "" else flavor);
# string -> string
# convert flavor to full theme name in kebab case
# a convenience to deal with the main flavor naming
getKebabTheme = flavor: if (flavor == "main") then "rose-pine" else "rose-pine-${flavor}";
# string -> string
# convert flavor to full theme name in snake case
# a convenience to deal with the main flavor naming
getSnakeTheme = flavor: if (flavor == "main") then "rose_pine" else "rose_pine_${flavor}";
# string -> string
# this capitalizes the first letter in a string,
# which is sometimes needed in order to format
# the names of themes correctly
mkUpper = str:
mkUpper =
str:
(lib.toUpper (builtins.substring 0 1 str)) + (builtins.substring 1 (builtins.stringLength str) str);
# a -> path -> a
# fromJSON but for yaml (and without readFile)
# a should be the local pkgs attrset
fromYaml = file: let
# convert to json
json = pkgs.runCommand "converted.json" {} ''
${lib.getExe pkgs.yj} < ${file} > $out
'';
in
fromYaml =
file:
let
# convert to json
json = pkgs.runCommand "converted.json" { } ''
${lib.getExe pkgs.yj} < ${file} > $out
'';
in
builtins.fromJSON (builtins.readFile json);
# a -> path -> a
# fromJSON but for ini (and without readFile)
# a should be the local pkgs attrset
fromINI = file: let
# convert to json
json = pkgs.runCommand "converted.json" {} ''
${lib.getExe pkgs.jc} --ini < ${file} > $out
'';
in
fromINI =
file:
let
# convert to json
json = pkgs.runCommand "converted.json" { } ''
${lib.getExe pkgs.jc} --ini < ${file} > $out
'';
in
builtins.fromJSON (builtins.readFile json);
# a -> path -> a
# fromJSON but for raw ini (and without readFile)
# a should be the local pkgs attrset
fromINIRaw = file: let
inherit (builtins) fromJSON readFile;
fromINIRaw =
file:
let
inherit (builtins) fromJSON readFile;
# convert to json
json = with pkgs;
runCommand "converted.json" {} ''
${jc}/bin/jc --ini -r < ${file} > $out
'';
in
# convert to json
json =
with pkgs;
runCommand "converted.json" { } ''
${jc}/bin/jc --ini -r < ${file} > $out
'';
in
fromJSON (readFile json);
# string -> a
@ -91,18 +117,18 @@ in {
# of the module, while `enableDefault` is a boolean
# representing the default of the created `enable`
# option
mkRosePineOpt = {
name,
enableDefault ? config.rose-pine.enable,
}: {
enable =
lib.mkEnableOption "Rose Pine theme for ${name}"
// {
mkRosePineOpt =
{
name,
enableDefault ? config.rose-pine.enable,
}:
{
enable = lib.mkEnableOption "Rose Pine theme for ${name}" // {
default = enableDefault;
};
flavor = rp.mkFlavorOpt name;
};
flavor = rp.mkFlavorOpt name;
};
# string -> a
# this creates an accent option for modules
@ -120,17 +146,18 @@ in {
# returns the current release version of nixos or home-manager. throws an evaluation error if neither are
# found
getModuleRelease =
config.home.version.release
or config.system.nixos.release
or (throw "Couldn't determine release version!");
config.home.version.release or config.system.nixos.release
or (throw "Couldn't determine release version!");
# string -> a -> a
# if the current module release is less than `minVersion`, all options are made no-ops with
# `lib.mkSinkUndeclaredOptions`
mkVersionedOpts = minVersion: option:
if lib.versionAtLeast rp.getModuleRelease minVersion
then option
else lib.mkSinkUndeclaredOptions {};
mkVersionedOpts =
minVersion: option:
if lib.versionAtLeast rp.getModuleRelease minVersion then
option
else
lib.mkSinkUndeclaredOptions { };
# string -> a
# this is to ensure users are running a supported version of nixos/home-manager

View file

@ -2,15 +2,17 @@
config,
lib,
...
}: let
}:
let
inherit (config.rose-pine) sources;
cfg = config.console.rose-pine;
enable = cfg.enable && config.console.enable;
palette = (lib.importJSON "${sources.rose-pine-palette}/palette.json").${cfg.flavor}.colors;
in {
options.console.rose-pine = lib.rp.mkRosePineOpt {name = "console";};
in
{
options.console.rose-pine = lib.rp.mkRosePineOpt { name = "console"; };
config.console.colors = lib.mkIf enable (
# Manually populate with colors from rose-pine/linux-tty

View file

@ -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 Rosé 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;

View file

@ -2,13 +2,15 @@
config,
lib,
...
}: let
}:
let
inherit (config.rose-pine) sources;
cfg = config.boot.loader.grub.rose-pine;
enable = cfg.enable && config.boot.loader.grub.enable;
in {
options.boot.loader.grub.rose-pine = lib.rp.mkRosePineOpt {name = "grub";};
in
{
options.boot.loader.grub.rose-pine = lib.rp.mkRosePineOpt { name = "grub"; };
config.boot.loader.grub = lib.mkIf enable {
theme = sources.grub;

View file

@ -3,18 +3,21 @@
config,
pkgs,
...
}: let
}:
let
inherit (config.rose-pine) sources;
cfg = config.services.displayManager.sddm.rose-pine;
enable = cfg.enable && config.services.displayManager.sddm.enable;
in {
options.services.displayManager.sddm.rose-pine = lib.rp.mkRosePineOpt {name = "sddm";};
in
{
options.services.displayManager.sddm.rose-pine = lib.rp.mkRosePineOpt { name = "sddm"; };
config = lib.mkIf enable {
services.displayManager.sddm.theme = "rose-pine";
environment.systemPackages = [
(pkgs.callPackage ./sddm-rose-pine-pkg.nix {inherit sources;})
(pkgs.callPackage ./sddm-rose-pine-pkg.nix { inherit sources; })
];
};
}