summaryrefslogtreecommitdiffstats
path: root/lass/2configs/alacritty.nix
blob: 903ddf6cc2894df4a1af4e6ed920cdecf95e1a51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
{ config, lib, pkgs, ... }: let

  alacritty-cfg = extrVals: builtins.toJSON ({
    font = {
      normal = {
        family = "Inconsolata";
        style = "Regular";
      };
      bold = {
        family = "Inconsolata";
        style = "Bold";
      };
      italic = {
        family = "Inconsolata";
        style = "Italic";
      };
      bold_italic = {
        family = "Inconsolata";
        style = "Bold Italic";
      };
      size = 8;
    };
    live_config_reload = true;
    window.dimensions = {
      columns = 80;
      lines = 20;
    };
    # window.opacity = 0;
    hints.enabled = [
      {
        regex = ''(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\u0000-\u001F\u007F-\u009F<>"\s{-}\^⟨⟩`]+'';
        command = "/run/current-system/sw/bin/xdg-open";
        post_processing = true;
        mouse.enabled = true;
        binding = {
          key = "U";
          mods = "Alt";
        };
      }
    ];
  } // extrVals);

  alacritty = pkgs.symlinkJoin {
    name = "alacritty";
    paths = [
      (pkgs.writeDashBin "alacritty" ''
        ${pkgs.alacritty}/bin/alacritty --config-file /var/theme/config/alacritty.yaml "$@"
      '')
      pkgs.alacritty
    ];
  };

in {
  environment.etc = {
    "themes/light/alacritty.yaml".text = alacritty-cfg {
      colors = {
        # Default colors
        primary = {
          # hard contrast: background = '#f9f5d7'
          # background = "#fbf1c7";
          background = "#f9f5d7";
          # soft contrast: background = '#f2e5bc'
          foreground = "#3c3836";
        };

        # Normal colors
        normal = {
          black = "#fbf1c7";
          red =     "#cc241d";
          green =   "#98971a";
          yellow =  "#d79921";
          blue =    "#458588";
          magenta = "#b16286";
          cyan =    "#689d6a";
          white =   "#7c6f64";
        };

        # Bright colors
        bright = {
          black =   "#928374";
          red =     "#9d0006";
          green =   "#79740e";
          yellow =  "#b57614";
          blue =    "#076678";
          magenta = "#8f3f71";
          cyan =    "#427b58";
          white =   "#3c3836";
        };
      };
    };
    "themes/dark/alacritty.yaml".text = alacritty-cfg {
      colors = {
        # Default colors
        primary = {
          background = "0x000000";
          foreground = "0xffffff";
        };
        cursor = {
          text = "0xF81CE5";
          cursor = "0xffffff";
        };

        # Normal colors
        normal = {
          black = "0x000000";
          red = "0xfe0100";
          green = "0x33ff00";
          yellow = "0xfeff00";
          blue = "0x0066ff";
          magenta = "0xcc00ff";
          cyan = "0x00ffff";
          white = "0xd0d0d0";
        };

        # Bright colors
        bright = {
          black = "0x808080";
          red = "0xfe0100";
          green = "0x33ff00";
          yellow = "0xfeff00";
          blue = "0x0066ff";
          magenta = "0xcc00ff";
          cyan = "0x00ffff";
          white = "0xFFFFFF";
        };
      };
    };
  };
  environment.systemPackages = [ alacritty ];
}