helix: add support for path and string themes (#6814)

This commit is contained in:
awwpotato 2025-04-13 11:59:21 -07:00 committed by GitHub
parent db56335ca8
commit 4f898f373d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -131,7 +131,13 @@ in
};
themes = mkOption {
type = types.attrsOf tomlFormat.type;
type = types.attrsOf (
types.oneOf [
tomlFormat.type
types.path
types.lines
]
);
default = { };
example = literalExpression ''
{
@ -245,7 +251,13 @@ in
themes = lib.mapAttrs' (
n: v:
lib.nameValuePair "helix/themes/${n}.toml" {
source = tomlFormat.generate "helix-theme-${n}" v;
source =
if lib.isAttrs v then
tomlFormat.generate "helix-theme-${n}" v
else if builtins.isPath cfg.style || lib.isStorePath cfg.style then
cfg.style
else
pkgs.writeText "helix-theme-${n}" v;
}
) cfg.themes;
in