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
(cherry picked from commit dfc859f54d)
49 lines
1 KiB
Nix
49 lines
1 KiB
Nix
{ mkTarget, lib, ... }:
|
|
mkTarget {
|
|
options = {
|
|
variant256Colors = lib.mkOption {
|
|
description = ''
|
|
Whether to use the [256-color variant](https://github.com/kdrag0n/base16-kitty#256-color-variants)
|
|
rather than the default combination of colors.
|
|
'';
|
|
type = lib.types.bool;
|
|
default = false;
|
|
};
|
|
};
|
|
|
|
config = [
|
|
(
|
|
{ fonts }:
|
|
{
|
|
programs.kitty.font = {
|
|
inherit (fonts.monospace) package name;
|
|
size = fonts.sizes.terminal;
|
|
};
|
|
}
|
|
)
|
|
(
|
|
{ opacity }:
|
|
{
|
|
programs.kitty.settings.background_opacity = toString opacity.terminal;
|
|
}
|
|
)
|
|
(
|
|
{
|
|
cfg,
|
|
colors,
|
|
inputs,
|
|
}:
|
|
let
|
|
theme = colors {
|
|
templateRepo = inputs.tinted-kitty;
|
|
target = if cfg.variant256Colors then "base16-256-deprecated" else "base16";
|
|
};
|
|
in
|
|
{
|
|
programs.kitty.extraConfig = ''
|
|
include ${theme}
|
|
'';
|
|
}
|
|
)
|
|
];
|
|
}
|