From 758fe63490093650075ec7587b7a6eb38614a4dd Mon Sep 17 00:00:00 2001 From: awwpotato Date: Sun, 13 Apr 2025 12:21:54 -0700 Subject: [PATCH] helix: use theme option Link: https://github.com/danth/stylix/pull/1146 Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com> --- flake.lock | 6 +++--- modules/helix/hm.nix | 34 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/flake.lock b/flake.lock index e31a0bff..844172a0 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/modules/helix/hm.nix b/modules/helix/hm.nix index 786ae8ea..96c48eea 100644 --- a/modules/helix/hm.nix +++ b/modules/helix/hm.nix @@ -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; + }; }; }