tmux: allow setting default-shell before new-session
This commit is contained in:
parent
7c3c64208e
commit
9c14bbe988
|
@ -27,6 +27,7 @@ let
|
|||
defaultResize = 5;
|
||||
defaultShortcut = "b";
|
||||
defaultTerminal = "screen";
|
||||
defaultShell = null;
|
||||
|
||||
boolToStr = value: if value then "on" else "off";
|
||||
|
||||
|
@ -41,7 +42,10 @@ let
|
|||
set -g default-terminal "${cfg.terminal}"
|
||||
set -g base-index ${toString cfg.baseIndex}
|
||||
setw -g pane-base-index ${toString cfg.baseIndex}
|
||||
|
||||
${optionalString (cfg.shell != null) ''
|
||||
# We need to set default-shell before calling new-session
|
||||
set -g default-shell "${cfg.shell}"
|
||||
''}
|
||||
${optionalString cfg.newSession "new-session"}
|
||||
|
||||
${optionalString cfg.reverseSplit ''
|
||||
|
@ -250,6 +254,13 @@ in
|
|||
description = "Set the $TERM variable.";
|
||||
};
|
||||
|
||||
shell = mkOption {
|
||||
default = defaultShell;
|
||||
example = "\${pkgs.zsh}/bin/zsh";
|
||||
type = with types; nullOr str;
|
||||
description = "Set the default-shell tmux variable.";
|
||||
};
|
||||
|
||||
secureSocket = mkOption {
|
||||
default = pkgs.stdenv.isLinux;
|
||||
type = types.bool;
|
||||
|
|
30
tests/modules/programs/tmux/default-shell.conf
Normal file
30
tests/modules/programs/tmux/default-shell.conf
Normal file
|
@ -0,0 +1,30 @@
|
|||
# ============================================= #
|
||||
# Start with defaults from the Sensible plugin #
|
||||
# --------------------------------------------- #
|
||||
run-shell @sensible_rtp@
|
||||
# ============================================= #
|
||||
|
||||
set -g default-terminal "screen"
|
||||
set -g base-index 0
|
||||
setw -g pane-base-index 0
|
||||
# We need to set default-shell before calling new-session
|
||||
set -g default-shell "/usr/bin/myshell"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set -g status-keys emacs
|
||||
set -g mode-keys emacs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
setw -g aggressive-resize off
|
||||
setw -g clock-mode-style 12
|
||||
set -s escape-time 500
|
||||
set -g history-limit 2000
|
||||
|
27
tests/modules/programs/tmux/default-shell.nix
Normal file
27
tests/modules/programs/tmux/default-shell.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
substituteExpected = path:
|
||||
pkgs.substituteAll {
|
||||
src = path;
|
||||
|
||||
sensible_rtp = pkgs.tmuxPlugins.sensible.rtp;
|
||||
};
|
||||
|
||||
in {
|
||||
config = {
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
shell = "/usr/bin/myshell";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.tmux.conf
|
||||
assertFileContent home-files/.tmux.conf \
|
||||
${substituteExpected ./default-shell.conf}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -4,4 +4,5 @@
|
|||
tmux-vi-all-true = ./vi-all-true.nix;
|
||||
tmux-secure-socket-enabled = ./secure-socket-enabled.nix;
|
||||
tmux-disable-confirmation-prompt = ./disable-confirmation-prompt.nix;
|
||||
tmux-default-shell = ./default-shell.nix;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue