mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
vivid: modify themes option with custom nix entries
This commit is contained in:
parent
c4aaddeaec
commit
904fa32d77
4 changed files with 52 additions and 3 deletions
|
|
@ -80,7 +80,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
themes = mkOption {
|
themes = mkOption {
|
||||||
type = with types; attrsOf path;
|
type = with types; attrsOf (either path yamlFormat.type);
|
||||||
default = { };
|
default = { };
|
||||||
example = lib.literalExpression ''
|
example = lib.literalExpression ''
|
||||||
{
|
{
|
||||||
|
|
@ -93,10 +93,27 @@ in
|
||||||
url = "https://raw.githubusercontent.com/NearlyTRex/Vivid/refs/heads/master/themes/catppuccin-mocha.yml";
|
url = "https://raw.githubusercontent.com/NearlyTRex/Vivid/refs/heads/master/themes/catppuccin-mocha.yml";
|
||||||
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
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 =
|
config =
|
||||||
|
|
@ -116,7 +133,10 @@ in
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// (lib.mapAttrs' (
|
// (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);
|
) cfg.themes);
|
||||||
|
|
||||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
themes = {
|
themes = {
|
||||||
ayu = ./themes/ayu.yml;
|
ayu = ./themes/ayu.yml;
|
||||||
mocha = ./themes/mocha.yml;
|
mocha = ./themes/mocha.yml;
|
||||||
|
tiny = import ./themes/tiny.nix;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -41,5 +42,9 @@
|
||||||
assertFileExists home-files/.config/vivid/themes/mocha.yml
|
assertFileExists home-files/.config/vivid/themes/mocha.yml
|
||||||
assertFileContent home-files/.config/vivid/themes/mocha.yml \
|
assertFileContent home-files/.config/vivid/themes/mocha.yml \
|
||||||
${./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}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
15
tests/modules/programs/vivid/themes/tiny.nix
Normal file
15
tests/modules/programs/vivid/themes/tiny.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
colors = {
|
||||||
|
primary = "00aaff";
|
||||||
|
secondary = "ff00aa";
|
||||||
|
};
|
||||||
|
core = {
|
||||||
|
directory = {
|
||||||
|
foreground = "primary";
|
||||||
|
};
|
||||||
|
"executable-file" = {
|
||||||
|
foreground = "secondary";
|
||||||
|
"font-style" = "bold";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
9
tests/modules/programs/vivid/themes/tiny.yml
Normal file
9
tests/modules/programs/vivid/themes/tiny.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
colors:
|
||||||
|
primary: 00aaff
|
||||||
|
secondary: ff00aa
|
||||||
|
core:
|
||||||
|
directory:
|
||||||
|
foreground: primary
|
||||||
|
executable-file:
|
||||||
|
font-style: bold
|
||||||
|
foreground: secondary
|
||||||
Loading…
Add table
Add a link
Reference in a new issue