nixos-config/home/terminals.nix

94 lines
2.2 KiB
Nix
Raw Normal View History

{ lib, ... }:
with lib;
let
colors = {
primary = {
background = "000000";
foreground = "ffffff";
};
cursor = {
# Text under cursor
text = "f81ce5";
# Foreground of cursor
cursor = "ffffff";
};
# Numbered colors in standard order (see colorNames)
normal = [
"000000"
"fe0100"
"33ff00"
"feff00"
"0066ff"
"cc00ff"
"00ffff"
"d0d0d0"
];
bright = [
"808080"
"fe0100"
"33ff00"
"feff00"
"0066ff"
"cc00ff"
"00ffff"
"ffffff"
];
};
colorNames =
[ "black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" ];
namedColors = prefix: colors:
listToAttrs
(zipListsWith nameValuePair colorNames (map (c: prefix + c) colors));
numberedColors = attrPrefix: valuePrefix: attrOffset: colors:
listToAttrs (zipListsWith nameValuePair
(map (i: attrPrefix + toString (i + attrOffset)) (range 0 7))
(map (c: valuePrefix + c) colors));
font = {
name = "Fira Code";
size = 9;
};
in {
# Not used on most systems
programs.foot = {
settings = {
main.font = "${font.name}:size=${toString font.size}";
colors = colors.primary // (numberedColors "regular" "" 0 colors.normal)
// (numberedColors "bright" "" 0 colors.bright);
};
};
programs.alacritty = {
enable = true;
settings = {
scrolling.history = 16384;
font = {
normal.family = font.name;
inherit (font) size;
};
colors = with colors; {
primary = mapAttrs (_: value: "0x" + value) primary;
cursor = mapAttrs (_: value: "0x" + value) cursor;
normal = namedColors "0x" normal;
bright = namedColors "0x" bright;
};
};
};
programs.kitty = {
enable = true;
inherit font;
settings = {
update_check_interval = 0;
close_on_child_death = true;
confirm_os_window_close = 2;
enable_audio_bell = 0;
term = "kitty";
clipboard_control = false;
scrollback_lines = 32768;
touch_scroll_multiplier = 4;
} // (numberedColors "color" "#" 0 colors.normal)
// (numberedColors "color" "#" 8 colors.bright);
};
}