From 34c13b077f679d3f5a22a456908240dc1c4b24ff Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 22 Feb 2023 16:04:20 +0000 Subject: [PATCH] home: zsh: refactor tmux auto-launch configuration Introduce an actual option for this behaviour. --- home/zsh/default.nix | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/home/zsh/default.nix b/home/zsh/default.nix index e17bb49..edbff52 100644 --- a/home/zsh/default.nix +++ b/home/zsh/default.nix @@ -5,6 +5,10 @@ in { options.my.home.zsh = with lib; { enable = my.mkDisableOption "zsh configuration"; + + launchTmux = mkEnableOption "auto launch tmux at shell start" // { + default = config.my.home.tmux.enable; + }; }; config = lib.mkIf cfg.enable { @@ -44,14 +48,16 @@ in defaultKeymap = "emacs"; # Make those happen early to avoid doing double the work - initExtraFirst = - lib.optionalString config.my.home.tmux.enable '' - # Launch tmux unless already inside one - if [ -z "$TMUX" ]; then - exec tmux new-session - fi - '' - ; + initExtraFirst = '' + ${ + lib.optionalString cfg.launchTmux '' + # Launch tmux unless already inside one + if [ -z "$TMUX" ]; then + exec tmux new-session + fi + '' + } + ''; initExtra = '' source ${./completion-styles.zsh}