Compare commits

...

5 commits

Author SHA1 Message Date
Bruno BELANYI 607d11bbad home: zsh: disable tmux auto-launch by default
All checks were successful
continuous-integration/drone/push Build is passing
2023-02-22 16:12:30 +00:00
Bruno BELANYI 06989facc2 machines: porthos: home: enable tmux auto-launch
I'm about to flip the default to always disabled, so enable it
explicitly.
2023-02-22 16:12:07 +00:00
Bruno BELANYI 55b828cba9 machines: porthos: add home configuration 2023-02-22 16:12:07 +00:00
Bruno BELANYI 34c13b077f home: zsh: refactor tmux auto-launch configuration
Introduce an actual option for this behaviour.
2023-02-22 16:11:18 +00:00
Bruno BELANYI 0bbf522c03 home: tmux: change 'use lib.my' to 'use libs' 2023-02-22 16:00:26 +00:00
3 changed files with 22 additions and 10 deletions

View file

@ -3,8 +3,10 @@ let
cfg = config.my.home.zsh; cfg = config.my.home.zsh;
in in
{ {
options.my.home.zsh = with lib.my; { options.my.home.zsh = with lib; {
enable = mkDisableOption "zsh configuration"; enable = my.mkDisableOption "zsh configuration";
launchTmux = mkEnableOption "auto launch tmux at shell start";
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -44,14 +46,16 @@ in
defaultKeymap = "emacs"; defaultKeymap = "emacs";
# Make those happen early to avoid doing double the work # Make those happen early to avoid doing double the work
initExtraFirst = initExtraFirst = ''
lib.optionalString config.my.home.tmux.enable '' ${
# Launch tmux unless already inside one lib.optionalString cfg.launchTmux ''
if [ -z "$TMUX" ]; then # Launch tmux unless already inside one
exec tmux new-session if [ -z "$TMUX" ]; then
fi exec tmux new-session
'' fi
; ''
}
'';
initExtra = '' initExtra = ''
source ${./completion-styles.zsh} source ${./completion-styles.zsh}

View file

@ -5,6 +5,7 @@
imports = [ imports = [
./boot.nix ./boot.nix
./hardware.nix ./hardware.nix
./home.nix
./networking.nix ./networking.nix
./services.nix ./services.nix
./users.nix ./users.nix

View file

@ -0,0 +1,7 @@
{ ... }:
{
my.home = {
# Always start a tmux session when opening a shell session
zsh.launchTmux = true;
};
}