1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

vivid: modify themes option with custom nix entries

This commit is contained in:
Mirza Arnaut 2025-10-12 02:05:48 +02:00 committed by Austin Horstman
parent c4aaddeaec
commit 904fa32d77
4 changed files with 52 additions and 3 deletions

View file

@ -80,7 +80,7 @@ in
};
themes = mkOption {
type = with types; attrsOf path;
type = with types; attrsOf (either path yamlFormat.type);
default = { };
example = lib.literalExpression ''
{
@ -93,10 +93,27 @@ in
url = "https://raw.githubusercontent.com/NearlyTRex/Vivid/refs/heads/master/themes/catppuccin-mocha.yml";
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
};
my-custom-theme = {
colors = {
blue = "0000ff";
};
core = {
directory = {
foreground = "blue";
font-style = "bold";
};
};
};
}
'';
description = "Theme for vivid";
description = ''
An attribute set of vivid themes.
Each value can either be a path to a theme file or an attribute set
defining the theme directly (which will be converted from Nix to YAML).
'';
};
};
config =
@ -116,7 +133,10 @@ in
};
}
// (lib.mapAttrs' (
name: path: lib.nameValuePair "vivid/themes/${name}.yml" { source = path; }
name: value:
lib.nameValuePair "vivid/themes/${name}.yml" {
source = if lib.isAttrs value then yamlFormat.generate "${name}.yml" value else value;
}
) cfg.themes);
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''

View file

@ -26,6 +26,7 @@
themes = {
ayu = ./themes/ayu.yml;
mocha = ./themes/mocha.yml;
tiny = import ./themes/tiny.nix;
};
};
@ -41,5 +42,9 @@
assertFileExists home-files/.config/vivid/themes/mocha.yml
assertFileContent home-files/.config/vivid/themes/mocha.yml \
${./themes/mocha.yml}
assertFileExists home-files/.config/vivid/themes/tiny.yml
assertFileContent home-files/.config/vivid/themes/tiny.yml \
${./themes/tiny.yml}
'';
}

View file

@ -0,0 +1,15 @@
{
colors = {
primary = "00aaff";
secondary = "ff00aa";
};
core = {
directory = {
foreground = "primary";
};
"executable-file" = {
foreground = "secondary";
"font-style" = "bold";
};
};
}

View file

@ -0,0 +1,9 @@
colors:
primary: 00aaff
secondary: ff00aa
core:
directory:
foreground: primary
executable-file:
font-style: bold
foreground: secondary