Move tmux into options

This commit is contained in:
Andreas Zweili 2023-05-31 21:12:50 +02:00
parent 5bcd70ad09
commit 371c325606
8 changed files with 77 additions and 67 deletions

View File

@ -15,6 +15,7 @@
./pipewire
./rdp
./telegram-notifications
./tmux
./username
];
}

View File

@ -2,7 +2,6 @@
{
imports = [
"${inputs.self}/modules/scripts"
"${inputs.self}/modules/tmux"
];
networking = {
networkmanager.enable = true;
@ -56,6 +55,7 @@
az-hunspell.enable = true;
az-idevices.enable = true;
az-nix-direnv.enable = true;
az-tmux = true;
};
xdg = {

View File

@ -1,67 +1,76 @@
{ ... }:
{ config, lib, ... }:
let
cfg = config.programs.az-tmux;
in
{
programs.tmux = {
enable = true;
extraConfig = ''
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"
set-option -g history-limit 300000
options = {
programs.az-tmux.enable = lib.mkEnableOption "Enable tmux";
};
# enable vim like key bindings
set-window-option -g mode-keys vi
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
config = lib.mkIf cfg.enable {
programs.tmux = {
enable = true;
extraConfig = ''
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"
set-option -g history-limit 300000
# changing default delay
set -s escape-time 1
# enable vim like key bindings
set-window-option -g mode-keys vi
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
# window navigation with the meta key + vim keybinding
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D
# changing default delay
set -s escape-time 1
# enable logging on key P
bind P pipe-pane -o "cat >>~/#W.log" \; display-message "Toggled logging to ~/#W.log"
# window navigation with the meta key + vim keybinding
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D
### Status bar design
# status line
set -g status-justify left
set -g status-bg black
set -g status-fg white
set -g status-interval 2
# enable logging on key P
bind P pipe-pane -o "cat >>~/#W.log" \; display-message "Toggled logging to ~/#W.log"
# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I#[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I#[fg=colour8]#[bg=colour14] #W "
### Status bar design
# status line
set -g status-justify left
set -g status-bg black
set -g status-fg white
set -g status-interval 2
# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none
# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I#[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I#[fg=colour8]#[bg=colour14] #W "
# The modes
setw -g clock-mode-colour colour135
# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none
# The statusbar
set -g status-position top
set -g status-bg colour234
set -g status-fg colour137
set -g status-left ""
set -g status-right '#[fg=colour233,bg=colour245,bold] %m-%d %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-format '#I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
setw -g window-status-format '#I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
'';
# The modes
setw -g clock-mode-colour colour135
# The statusbar
set -g status-position top
set -g status-bg colour234
set -g status-fg colour137
set -g status-left ""
set -g status-right '#[fg=colour233,bg=colour245,bold] %m-%d %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-format '#I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
setw -g window-status-format '#I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
'';
};
};
}

View File

@ -5,7 +5,7 @@
ip = "10.7.89.10";
inherit hostname;
})
"${inputs.self}/modules/tmux"
];
services.az-docker.enable = true;
programs.az-tmux.enable = true;
}

View File

@ -12,7 +12,6 @@
tag = "management";
time = "23:30";
})
"${inputs.self}/modules/tmux"
];
fileSystems = {
"/mnt/external" = {
@ -29,6 +28,7 @@
programs = {
az-hunspell.enable = true;
az-nix-direnv.enable = true;
az-tmux.enable = true;
};
}

View File

@ -6,7 +6,6 @@ in
imports = [
inputs.nixos-hardware.nixosModules.raspberry-pi-4
"${inputs.self}/modules/log-to-ram"
"${inputs.self}/modules/tmux"
];
boot = {
@ -125,6 +124,8 @@ in
systemd.services."network-addresses-usb0".after = [ "usb-otg.service" ];
services.az-docker.enable = true;
programs.az-nix-direnv.enable = true;
programs = {
az-nix-direnv.enable = true;
az-tmux.enable = true;
};
}

View File

@ -7,7 +7,6 @@
"${inputs.self}/modules/desktop"
"${inputs.self}/modules/restic-client-desktop"
"${inputs.self}/modules/tlp"
"${inputs.self}/modules/tmux"
];
boot.initrd.availableKernelModules = [
"aesni_intel"
@ -44,16 +43,15 @@
az-bluetooth.enable = true;
az-dvd.enable = true;
};
programs = {
az-lockscreen.enable = true;
az-makemkv.enable = true;
az-tmux.enable = true;
};
services = {
az-docker.enable = true;
az-x86.enable = true;
};
virtualisation.virtualbox.host.enable = true;
}

View File

@ -5,9 +5,10 @@
ip = "10.7.89.40";
inherit hostname;
})
"${inputs.self}/modules/tmux"
];
services.az-docker.enable = true;
programs.az-nix-direnv.enable = true;
programs = {
az-nix-direnv.enable = true;
az-tmux = true;
};
}