11.stylix/modules/helix/hm.nix
NAHO dfc859f54d
treewide: optionalize mkTarget's humanName and name arguments
Optionalize mkTarget's 'humanName' and 'name' arguments by inferring
'humanName' from the 'name' attribute in the /modules/<MODULE>/meta.nix
file, and 'name' from the /modules/<NAME>/ directory name.

Inferring the 'humanName' and 'name' arguments ensures consistency and
reduces boilerplate.

The 'humanName' and 'name' arguments are optionalized instead of removed
because complex modules generating target derivations need to
distinguish between them.

Closes: https://github.com/nix-community/stylix/issues/1661
2025-12-10 14:48:37 +01:00

46 lines
1 KiB
Nix

{
mkTarget,
pkgs,
lib,
...
}:
mkTarget {
options.transparent = lib.mkEnableOption "transparent theming" // {
internal = true;
default = false;
};
config = [
(
{ opacity }:
{
stylix.targets.helix.transparent = opacity.terminal != 1.0;
}
)
(
{
cfg,
colors,
inputs,
}:
{
programs.helix = {
settings.theme = "stylix";
themes.stylix =
let
theme = colors { templateRepo = 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 cfg.transparent then transparentTheme else theme;
};
}
)
];
}