1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/configs/alacritty.nix

64 lines
1.7 KiB
Nix

{
pkgs,
lib,
config,
...
}: let
alacritty-cfg = theme:
(pkgs.formats.yaml {}).generate "alacritty.yml" {
window.opacity = 0.99;
font = {
normal.family = "Monospace";
size = 6;
};
live_config_reload = true;
key_bindings = [
{
key = "Plus";
mods = "Control";
action = "IncreaseFontSize";
}
{
key = "Minus";
mods = "Control";
action = "DecreaseFontSize";
}
{
key = "Key0";
mods = "Control";
action = "ResetFontSize";
}
];
colors = let
colourNames = ["black" "red" "green" "yellow" "blue" "magenta" "cyan" "white"];
colourPairs = lib.getAttrs colourNames theme;
in {
primary = {inherit (theme) background foreground;};
cursor = {inherit (theme) cursor;};
normal = lib.mapAttrs (_: colour: colour.dark) colourPairs;
bright = lib.mapAttrs (_: colour: colour.bright) colourPairs;
};
};
alacritty-pkg = pkgs.symlinkJoin {
name = "alacritty";
paths = [
(pkgs.writeDashBin "alacritty" ''
${pkgs.alacritty}/bin/alacritty --config-file /var/theme/config/alacritty.yml msg create-window "$@" ||
${pkgs.alacritty}/bin/alacritty --config-file /var/theme/config/alacritty.yml "$@"
'')
pkgs.alacritty
];
};
in {
environment.variables.TERMINAL = "alacritty";
environment.systemPackages = [
alacritty-pkg
];
environment.etc = {
"themes/dark/alacritty.yml".source = alacritty-cfg (import <niveum/lib/colours/owickstrom-dark.nix>);
"themes/light/alacritty.yml".source = alacritty-cfg (import <niveum/lib/colours/owickstrom-light.nix>);
};
}