installs tmux on servers

This commit is contained in:
Dennis 2026-01-29 10:41:04 +01:00
parent 288b52edc4
commit 59e440b59f
4 changed files with 65 additions and 4 deletions

View file

@ -22,10 +22,12 @@
just
mmv-go
zoxide
tmux
];
imports = [
../modules/ssh
../modules/tmux/server.nix
];
programs.home-manager.enable = true;

View file

@ -8,6 +8,10 @@
fish_greeting = "fortune -a";
localip = "ifconfig | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | head -n 1";
publicip = "curl -4 ifconfig.me";
enter_vps = "ssh dnsc-vps-sm -t tmux new -As main";
rebuild_vps = "ssh -t dnsc-vps-sm 'cd ~/nix-config && git pull && sudo just deploy'";
enter_server = "ssh dnsc-server -t tmux new -As main";
rebuild_server = "ssh -t dnsc-server 'cd ~/nix-config && git pull && sudo just deploy'";
kill_tunnels = /* fish */ ''
ps -o pid,command | grep "^[0-9]\{4,5\} ssh -fNL" | awk '{print $1}' | xargs kill -9
'';

59
modules/tmux/server.nix Normal file
View file

@ -0,0 +1,59 @@
{ pkgs, ... }:
{
programs.tmux = {
enable = true;
package = pkgs.tmux;
baseIndex = 1;
clock24 = true;
disableConfirmationPrompt = true;
mouse = true;
newSession = true;
prefix = "C-a";
shell = "${pkgs.fish}/bin/fish";
terminal = "screen-256color";
keyMode = "vi";
escapeTime = 0;
extraConfig = ''
set -g status-position bottom
set -g status-style bg=#1d202f,fg=white
set -g status-left ""
set -g status-right "#[bg=default,fg=magenta]>> #S << #[bg=default,fg=white]#{hostname_short} "
set-window-option -g window-status-style 'fg=magenta,bg=#1d202f'
set-window-option -g window-status-format ' #I #[fg=white]#W #[fg=cyan]#F '
set-window-option -g window-status-current-style "fg=black,bg=magenta"
set-window-option -g window-status-current-format " #I #W #F "
set -g pane-border-style fg=#807c9f
set -g pane-active-border-style fg=magenta
set -g message-style "fg=black,bg=red,bold"
unbind %
bind "|" split-window -h
unbind '"'
bind - split-window -l 15 -v
bind r source-file "~/.config/tmux/tmux.conf"
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
bind ? list-keys -a
unbind s
bind s display-popup -h 50% -w 80% -E sessionizer
unbind C-x
bind C-x kill-session
unbind v
bind v choose-tree -Zw "join-pane -t '%%'"
'';
};
}

View file

@ -5,7 +5,3 @@ windows:
layout: main-horizontal
panes:
- nvim +"lua Snacks.picker.files({ hidden = true })"
- run:
layout: even-vertical
panes:
- clear