nix all the things
1{
2 pkgs,
3 lib,
4 config,
5 ...
6}:
7let
8 zjstatus = pkgs.fetchurl {
9 url = "https://github.com/dj95/zjstatus/releases/download/v0.22.0/zjstatus.wasm";
10 sha256 = "0lyxah0pzgw57wbrvfz2y0bjrna9bgmsw9z9f898dgqw1g92dr2d";
11 };
12in
13lib.mkIf config.dev.shell.enable {
14 programs.zellij = {
15 enable = true;
16 settings = {
17 scroll_buffer_size = 5000;
18 default_shell = "nu";
19 post_command_discovery_hook = ''
20 direnv exec . -- ($env.RESURRECT_COMMAND)
21 '';
22 pane_frames = false;
23
24 keybinds = {
25 shared._children = [
26 {
27 bind = {
28 _args = [ "Alt f" ];
29 ToggleFloatingPanes = { };
30 };
31 }
32 ];
33 };
34 };
35 };
36
37 programs.nushell.configFile.text = ''
38 if ($env | get -o ZELLIJ | is-not-empty) {
39 $env.config = ($env.config | upsert hooks {
40 pre_prompt: [ {
41 zellij action rename-tab (pwd | path basename)
42 } ]
43 pre_execution: [ { ||
44 let cmd = if ((commandline | str length) > 8) {
45 (commandline | str substring 0..6) + "..."
46 } else commandline
47
48 zellij action rename-tab ((pwd | path basename) + ' | ' + ($cmd))
49 } ]
50 })
51 }
52 '';
53
54 # https://github.com/merikan/.dotfiles/blob/main/config/zellij/themes/zjstatus/catppuccin.kdl
55 xdg.configFile."zellij/layouts/default.kdl".text = ''
56 layout {
57 default_tab_template {
58 children
59 pane size=1 borderless=true {
60 plugin location="file://${zjstatus}" {
61 color_rosewater "#f4dbd6"
62 color_flamingo "#f0c6c6"
63 color_pink "#f5bde6"
64 color_mauve "#c6a0f6"
65 color_red "#ed8796"
66 color_maroon "#ee99a0"
67 color_peach "#f5a97f"
68 color_yellow "#eed49f"
69 color_green "#a6da95"
70 color_teal "#8bd5ca"
71 color_sky "#91d7e3"
72 color_sapphire "#7dc4e4"
73 color_blue "#8aadf4"
74 color_lavender "#b7bdf8"
75 color_text "#cad3f5"
76 color_subtext1 "#b8c0e0"
77 color_subtext0 "#a5adcb"
78 color_overlay2 "#939ab7"
79 color_overlay1 "#8087a2"
80 color_overlay0 "#6e738d"
81 color_surface2 "#5b6078"
82 color_surface1 "#494d64"
83 color_surface0 "#363a4f"
84 color_base "#24273a"
85 color_mantle "#1e2030"
86 color_crust "#181926"
87
88 format_left "#[bg=$surface0,fg=$sapphire]#[bg=$sapphire,fg=$crust,bold] {session} #[bg=$surface0]{mode}#[bg=$surface0] {tabs}"
89 format_center "{notifications}"
90 format_right "#[bg=$surface0,fg=$maroon]#[bg=$maroon,fg=$crust] #[bg=$surface1,fg=$maroon,bold] {datetime}#[bg=$surface0,fg=$surface1]"
91 format_space "#[bg=$surface0]"
92 format_hide_on_overlength "true"
93 format_precedence "lrc"
94
95 border_enabled "false"
96 border_char "─"
97 border_format "#[bg=$surface0]{char}"
98 border_position "top"
99
100 mode_normal "#[bg=$green,fg=$crust,bold] NORMAL#[bg=$surface0,fg=$green]"
101 mode_tmux "#[bg=$mauve,fg=$crust,bold] TMUX#[bg=$surface0,fg=$mauve]"
102 mode_locked "#[bg=$red,fg=$crust,bold] LOCKED#[bg=$surface0,fg=$red]"
103 mode_pane "#[bg=$teal,fg=$crust,bold] PANE#[bg=$surface0,fg=teal]"
104 mode_tab "#[bg=$teal,fg=$crust,bold] TAB#[bg=$surface0,fg=$teal]"
105 mode_scroll "#[bg=$flamingo,fg=$crust,bold] SCROLL#[bg=$surface0,fg=$flamingo]"
106 mode_enter_search "#[bg=$flamingo,fg=$crust,bold] ENT-SEARCH#[bg=$surfaco,fg=$flamingo]"
107 mode_search "#[bg=$flamingo,fg=$crust,bold] SEARCHARCH#[bg=$surfac0,fg=$flamingo]"
108 mode_resize "#[bg=$yellow,fg=$crust,bold] RESIZE#[bg=$surfac0,fg=$yellow]"
109 mode_rename_tab "#[bg=$yellow,fg=$crust,bold] RENAME-TAB#[bg=$surface0,fg=$yellow]"
110 mode_rename_pane "#[bg=$yellow,fg=$crust,bold] RENAME-PANE#[bg=$surface0,fg=$yellow]"
111 mode_move "#[bg=$yellow,fg=$crust,bold] MOVE#[bg=$surface0,fg=$yellow]"
112 mode_session "#[bg=$pink,fg=$crust,bold] SESSION#[bg=$surface0,fg=$pink]"
113 mode_prompt "#[bg=$pink,fg=$crust,bold] PROMPT#[bg=$surface0,fg=$pink]"
114
115 tab_normal "#[bg=$surface0,fg=$blue]#[bg=$blue,fg=$crust,bold]{index} #[bg=$surface1,fg=$blue,bold] {name}{floating_indicator}#[bg=$surface0,fg=$surface1]"
116 tab_normal_fullscreen "#[bg=$surface0,fg=$blue]#[bg=$blue,fg=$crust,bold]{index} #[bg=$surface1,fg=$blue,bold] {name}{fullscreen_indicator}#[bg=$surface0,fg=$surface1]"
117 tab_normal_sync "#[bg=$surface0,fg=$blue]#[bg=$blue,fg=$crust,bold]{index} #[bg=$surface1,fg=$blue,bold] {name}{sync_indicator}#[bg=$surface0,fg=$surface1]"
118 tab_active "#[bg=$surface0,fg=$peach]#[bg=$peach,fg=$crust,bold]{index} #[bg=$surface1,fg=$peach,bold] {name}{floating_indicator}#[bg=$surface0,fg=$surface1]"
119 tab_active_fullscreen "#[bg=$surface0,fg=$peach]#[bg=$peach,fg=$crust,bold]{index} #[bg=$surface1,fg=$peach,bold] {name}{fullscreen_indicator}#[bg=$surface0,fg=$surface1]"
120 tab_active_sync "#[bg=$surface0,fg=$peach]#[bg=$peach,fg=$crust,bold]{index} #[bg=$surface1,fg=$peach,bold] {name}{sync_indicator}#[bg=$surface0,fg=$surface1]"
121 tab_separator "#[bg=$surface0] "
122
123 tab_sync_indicator " "
124 tab_fullscreen_indicator " "
125 tab_floating_indicator " "
126
127 notification_format_unread "#[bg=surface0,fg=$yellow]#[bg=$yellow,fg=$crust] #[bg=$surface1,fg=$yellow] {message}#[bg=$surface0,fg=$yellow]"
128 notification_format_no_notifications ""
129 notification_show_interval "10"
130
131 command_user_command "whoami"
132 command_user_format "{stdout}"
133 command_user_interval "10"
134 command_user_rendermode "static"
135
136 datetime "{format}"
137 datetime_format "%Y-%m-%d %H:%M"
138 datetime_timezone "Europe/Paris"
139 }
140 }
141 }
142 }
143 '';
144}