From 405d71677835decf021df7a3c41dbf43f9570726 Mon Sep 17 00:00:00 2001 From: awwpotato Date: Sun, 13 Apr 2025 12:21:54 -0700 Subject: [PATCH] helix: use theme option --- flake.lock | 6 +++--- modules/helix/hm.nix | 34 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/flake.lock b/flake.lock index 76531c2ae..844172a0d 100644 --- a/flake.lock +++ b/flake.lock @@ -224,11 +224,11 @@ ] }, "locked": { - "lastModified": 1743869639, - "narHash": "sha256-Xhe3whfRW/Ay05z9m1EZ1/AkbV1yo0tm1CbgjtCi4rQ=", + "lastModified": 1744637364, + "narHash": "sha256-ZVINTNMJS6W3fqPYV549DSmjYQW5I9ceKBl83FwPP7k=", "owner": "nix-community", "repo": "home-manager", - "rev": "d094c6763c6ddb860580e7d3b4201f8f496a6836", + "rev": "337541447773985f825512afd0f9821a975186be", "type": "github" }, "original": { diff --git a/modules/helix/hm.nix b/modules/helix/hm.nix index 786ae8ea6..96c48eea3 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"; + + themes.stylix = + let + theme = config.lib.stylix.colors { + templateRepo = config.stylix.inputs.base16-helix; + }; - xdg.configFile."helix/themes/stylix.toml".source = - if config.stylix.opacity.terminal == 1.0 then theme else transparentTheme; + # 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; + }; }; }