alacritty.nix (3371B)
1 { config, pkgs, lib, ... }: 2 3 with lib; 4 5 let 6 mkColourOption = name: default: mkOption { 7 type = types.str; 8 default = default; 9 example = "#123456"; 10 description = "Colour value for ${name}."; 11 }; 12 13 in 14 { 15 options.alacritty = { 16 enable = mkEnableOption "Alacritty"; 17 18 font = mkOption { 19 type = types.str; 20 default = "Hack"; 21 example = "Hack"; 22 description = "Font used"; 23 }; 24 25 fontSize = mkOption { 26 type = types.int; 27 default = 9; 28 example = 10; 29 description = "Font size"; 30 }; 31 32 colours = { 33 bg = mkColourOption "bg" "#1d1f21"; 34 fg = mkColourOption "fg" "#c5c8c6"; 35 36 black = mkColourOption "black" "#1d1f21"; 37 black-bright = mkColourOption "black-bright" "#666666"; 38 39 red = mkColourOption "red" "#cc6666"; 40 red-bright = mkColourOption "red-bright" "#d54e53"; 41 42 green = mkColourOption "green" "#b5bd68"; 43 green-bright = mkColourOption "green-bright" "#b9ca4a"; 44 45 yellow = mkColourOption "yellow" "#f0c674"; 46 yellow-bright = mkColourOption "yellow-bright" "#e7c547"; 47 48 blue = mkColourOption "blue" "#81a2be"; 49 blue-bright = mkColourOption "blue-bright" "#7aa6da"; 50 51 magenta = mkColourOption "magenta" "#b294bb"; 52 magenta-bright = mkColourOption "magenta-bright" "#c397d8"; 53 54 cyan = mkColourOption "cyan" "#8abeb7"; 55 cyan-bright = mkColourOption "cyan-bright" "#70c0b1"; 56 57 white = mkColourOption "white" "#c5c8c6"; 58 white-bright = mkColourOption "white-bright" "#eaeaea"; 59 }; 60 }; 61 62 config = mkIf config.alacritty.enable { 63 programs.alacritty = { 64 enable = true; 65 66 settings = { 67 font = { 68 size = config.alacritty.fontSize; 69 normal = { 70 family = config.alacritty.font; 71 style = "Regular"; 72 }; 73 bold = { 74 family = config.alacritty.font; 75 style = "Bold"; 76 }; 77 italic = { 78 family = config.alacritty.font; 79 style = "Italic"; 80 }; 81 bold_italic = { 82 family = config.alacritty.font; 83 style = "Bold Italic"; 84 }; 85 }; 86 87 colors = { 88 primary = { 89 background = config.alacritty.colours.bg; 90 foreground = config.alacritty.colours.fg; 91 }; 92 normal = { 93 black = config.alacritty.colours.black; 94 red = config.alacritty.colours.red; 95 green = config.alacritty.colours.green; 96 yellow = config.alacritty.colours.yellow; 97 blue = config.alacritty.colours.blue; 98 magenta = config.alacritty.colours.magenta; 99 cyan = config.alacritty.colours.cyan; 100 white = config.alacritty.colours.white; 101 }; 102 bright = { 103 black-bright = config.alacritty.colours.black-bright; 104 red-bright = config.alacritty.colours.red-bright; 105 green-bright = config.alacritty.colours.green-bright; 106 yellow-bright = config.alacritty.colours.yellow-bright; 107 blue-bright = config.alacritty.colours.blue-bright; 108 magenta-bright = config.alacritty.colours.magenta-bright; 109 cyan-bright = config.alacritty.colours.cyan-bright; 110 white-bright = config.alacritty.colours.white-bright; 111 }; 112 }; 113 }; 114 }; 115 }; 116 }