mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
rio: add support for custom themes
This commit is contained in:
parent
e22fb25cde
commit
9d6e28fd32
4 changed files with 64 additions and 0 deletions
|
|
@ -28,6 +28,25 @@ in
|
|||
<https://raphamorim.io/rio/docs/#configuration-file> for options.
|
||||
'';
|
||||
};
|
||||
|
||||
themes = lib.mkOption {
|
||||
type = with lib.types; attrsOf (either settingsFormat.type path);
|
||||
default = { };
|
||||
description = ''
|
||||
Theme files written to {file}`$XDG_CONFIG_HOME/rio/themes/`. See
|
||||
<https://rioterm.com/docs/config#building-your-own-theme> for
|
||||
supported values.
|
||||
'';
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
foobar.colors = {
|
||||
background = "#282a36";
|
||||
green = "#50fa7b";
|
||||
dim-green = "#06572f";
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
meta.maintainers = [ lib.maintainers.otavio ];
|
||||
|
||||
|
|
@ -42,6 +61,16 @@ in
|
|||
xdg.configFile."rio/config.toml".source =
|
||||
if lib.isPath cfg.settings then cfg.settings else settingsFormat.generate "rio.toml" cfg.settings;
|
||||
})
|
||||
|
||||
(lib.mkIf (cfg.themes != { }) {
|
||||
xdg.configFile = lib.mapAttrs' (
|
||||
name: value:
|
||||
lib.nameValuePair "rio/themes/${name}.toml" {
|
||||
source =
|
||||
if builtins.isPath value then value else settingsFormat.generate "rio-theme-${name}.toml" value;
|
||||
}
|
||||
) cfg.themes;
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
rio-example-settings = ./example-settings.nix;
|
||||
rio-empty-settings = ./empty-settings.nix;
|
||||
rio-themes = ./example-themes.nix;
|
||||
}
|
||||
|
|
|
|||
30
tests/modules/programs/rio/example-themes.nix
Normal file
30
tests/modules/programs/rio/example-themes.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
programs.rio = {
|
||||
enable = true;
|
||||
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
|
||||
themes = {
|
||||
foobar.colors = {
|
||||
cyan = "#8be9fd";
|
||||
green = "#50fa7b";
|
||||
background = "#282a36";
|
||||
};
|
||||
|
||||
foobar2 = ./foobar.toml;
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/rio/themes/foobar.toml
|
||||
assertFileExists home-files/.config/rio/themes/foobar2.toml
|
||||
|
||||
assertFileContent \
|
||||
home-files/.config/rio/themes/foobar.toml \
|
||||
${./foobar.toml}
|
||||
assertFileContent \
|
||||
home-files/.config/rio/themes/foobar2.toml \
|
||||
${./foobar.toml}
|
||||
'';
|
||||
}
|
||||
4
tests/modules/programs/rio/foobar.toml
Normal file
4
tests/modules/programs/rio/foobar.toml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[colors]
|
||||
background = "#282a36"
|
||||
cyan = "#8be9fd"
|
||||
green = "#50fa7b"
|
||||
Loading…
Add table
Add a link
Reference in a new issue