helix: use theme option

Link: https://github.com/danth/stylix/pull/1146

Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
awwpotato 2025-04-13 12:21:54 -07:00 committed by NAHO
parent 8b0d9317ed
commit 758fe63490
2 changed files with 20 additions and 20 deletions

6
flake.lock generated
View file

@ -224,11 +224,11 @@
]
},
"locked": {
"lastModified": 1744618730,
"narHash": "sha256-n3gN7aHwVRnnBZI64EDoKyJnWidNYJ0xezhqQtdjH2Q=",
"lastModified": 1744637364,
"narHash": "sha256-ZVINTNMJS6W3fqPYV549DSmjYQW5I9ceKBl83FwPP7k=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "85dd758c703ffbf9d97f34adcef3a898b54b4014",
"rev": "337541447773985f825512afd0f9821a975186be",
"type": "github"
},
"original": {

View file

@ -4,20 +4,6 @@
lib,
...
}:
let
theme = config.lib.stylix.colors {
templateRepo = config.stylix.inputs.base16-helix;
};
# Removing the background exposes transparency from the terminal. The
# background might be helpful if the terminal isn't themed, so we only
# do this if transparency is actually enabled.
transparentTheme = pkgs.runCommandLocal "helix-transparent.toml" { } ''
sed 's/,\? bg = "base00"//g' <${theme} >$out
'';
in
{
options.stylix.targets.helix.enable =
config.lib.stylix.mkEnableTarget "Helix" true;
@ -30,9 +16,23 @@ in
&& config.programs.helix.enable
)
{
programs.helix.settings.theme = "stylix";
programs.helix = {
settings.theme = "stylix";
xdg.configFile."helix/themes/stylix.toml".source =
if config.stylix.opacity.terminal == 1.0 then theme else transparentTheme;
themes.stylix =
let
theme = config.lib.stylix.colors {
templateRepo = config.stylix.inputs.base16-helix;
};
# Removing the background exposes transparency from the terminal. The
# background might be helpful if the terminal isn't themed, so we only
# do this if transparency is actually enabled.
transparentTheme = pkgs.runCommandLocal "helix-transparent.toml" { } ''
sed 's/,\? bg = "base00"//g' <${theme} >$out
'';
in
if config.stylix.opacity.terminal == 1.0 then theme else transparentTheme;
};
};
}