11.stylix/modules/helix/hm.nix
Bernardo Meurer b42555850b
Move all templates into flake inputs (#165)
This reduces our reliance on import-from-derivation, so evaluation is faster.
2023-10-10 10:44:54 +01:00

27 lines
840 B
Nix

{ pkgs, config, lib, ... }:
let
theme = config.lib.stylix.colors {
templateRepo = config.lib.stylix.templates.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" config.programs.helix.enable;
config = lib.mkIf config.stylix.targets.helix.enable {
programs.helix.settings.theme = "stylix";
xdg.configFile."helix/themes/stylix.toml".source =
if config.stylix.opacity.terminal == 1.0
then theme
else transparentTheme;
};
}