DEVELOPMENT ENVIRONMENT

~liljamo/nix-arta

ref: 7a0d4248e17428d9faf69c3a84bb285a17df937f nix-arta/roles/zellij.nix -rw-r--r-- 2.6 KiB
7a0d4248Jonni Liljamo feat: move auth 8 days ago
                                                                                
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
{
  config,
  inputs,
  lib,
  pkgs,
  ...
}: let
  cfg = config.roles.zellij;

  # Hard light:
  # https://github.com/sainnhe/everforest/blob/master/palette.md#light
  # https://github.com/sainnhe/everforest/blob/e5b9e2fb676a9ded3e86ae51924f7962fa4fb0ac/autoload/everforest.vim#L51
  everforest = {
    bg0 = "#FFF9E8";
    bg1 = "#F8F5E4";
    bg2 = "#F2EFDF";
    bg3 = "#EDEADA";
    bg4 = "#E8E5D5";
    bg5 = "#BEC5B2";
    fg = {
      default = "#5C6A72";
      accent = {
        cyan = "#35A77C";
        green = "#8DA101";
      };
      grey0 = "#7A8478";
      grey1 = "#859289";
      grey2 = "#9DA9A0";
      statusline = {
        green = "#93B259";
        grey = "#708089";
        red = "#E66868";
      };
    };
  };

  zjstatus = ''
    plugin location="file:${inputs.zjstatus.packages.${pkgs.system}.default}/bin/zjstatus.wasm" {
      format_left "{mode}"
      format_center "{tabs}"

      mode_locked "#[fg=${everforest.bg0},bg=${everforest.fg.statusline.red},bold] {name} "
      mode_normal "#[fg=${everforest.bg0},bg=${everforest.fg.statusline.green},bold] {name} "
      mode_tab "#[fg=${everforest.bg0},bg=${everforest.fg.accent.cyan},bold] {name} "

      tab_active "#[fg=${everforest.bg0},bg=${everforest.fg.statusline.green}] {name} "
      tab_normal "#[fg=${everforest.fg.default},bg=${everforest.bg3}] {name} "
    }
  '';
in {
  options.roles.zellij = {
    enable = lib.mkEnableOption "enable zellij";
  };

  config = lib.mkIf cfg.enable {
    hm = {
      programs.zellij = {
        enable = true;
        settings = {
          default_shell = "elvish";
          simplified_ui = true;
          pane_frames = false;
          default_layout = "default";
          ui.pane_frames.hide_session_name = true;
        };
      };

      home.file.".config/zellij/layouts/default.kdl".text = ''
        layout {
          default_tab_template {
            children
            pane size=1 {
              ${zjstatus}
            }
          }

          tab {
            pane
          }
        }
      '';

      home.file.".config/zellij/layouts/dev.kdl".text = ''
        layout {
          default_tab_template {
            children
            pane size=1 {
              ${zjstatus}
            }
          }

          tab name="nvim" focus=true  {
            pane
          }

          tab name="shell" {
            pane
          }
        }

        keybinds {
          locked {
            bind "Insert" { GoToTab 2; SwitchToMode "Normal"; }
          }

          shared_except "locked" {
            bind "Insert" { GoToTab 1; SwitchToMode "Locked"; }
          }
        }
      '';
    };
  };
}