From 0bbf522c03a513bcbb626d15ca386b2df0d5d064 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 22 Feb 2023 16:00:26 +0000 Subject: [PATCH 1/5] home: tmux: change 'use lib.my' to 'use libs' --- home/zsh/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home/zsh/default.nix b/home/zsh/default.nix index bd5906d..e17bb49 100644 --- a/home/zsh/default.nix +++ b/home/zsh/default.nix @@ -3,8 +3,8 @@ let cfg = config.my.home.zsh; in { - options.my.home.zsh = with lib.my; { - enable = mkDisableOption "zsh configuration"; + options.my.home.zsh = with lib; { + enable = my.mkDisableOption "zsh configuration"; }; config = lib.mkIf cfg.enable { From 34c13b077f679d3f5a22a456908240dc1c4b24ff Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 22 Feb 2023 16:04:20 +0000 Subject: [PATCH 2/5] 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} From 55b828cba9c01e9845640f38cbd040c7c05f056f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 22 Feb 2023 16:05:28 +0000 Subject: [PATCH 3/5] machines: porthos: add home configuration --- machines/porthos/default.nix | 1 + machines/porthos/home.nix | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 machines/porthos/home.nix diff --git a/machines/porthos/default.nix b/machines/porthos/default.nix index abfc01a..6d7df29 100644 --- a/machines/porthos/default.nix +++ b/machines/porthos/default.nix @@ -5,6 +5,7 @@ imports = [ ./boot.nix ./hardware.nix + ./home.nix ./networking.nix ./services.nix ./users.nix diff --git a/machines/porthos/home.nix b/machines/porthos/home.nix new file mode 100644 index 0000000..ce312c4 --- /dev/null +++ b/machines/porthos/home.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + # To be filled out +} From 06989facc2f964d697f6400a50416c6d54eecda2 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 22 Feb 2023 16:09:15 +0000 Subject: [PATCH 4/5] machines: porthos: home: enable tmux auto-launch I'm about to flip the default to always disabled, so enable it explicitly. --- machines/porthos/home.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/machines/porthos/home.nix b/machines/porthos/home.nix index ce312c4..53d5d25 100644 --- a/machines/porthos/home.nix +++ b/machines/porthos/home.nix @@ -1,4 +1,7 @@ { ... }: { - # To be filled out + my.home = { + # Always start a tmux session when opening a shell session + zsh.launchTmux = true; + }; } From 607d11bbad7d72f927fac74e98eb749c2c9ab2d1 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 22 Feb 2023 16:09:45 +0000 Subject: [PATCH 5/5] home: zsh: disable tmux auto-launch by default --- home/zsh/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/home/zsh/default.nix b/home/zsh/default.nix index edbff52..84eb7a3 100644 --- a/home/zsh/default.nix +++ b/home/zsh/default.nix @@ -6,9 +6,7 @@ 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; - }; + launchTmux = mkEnableOption "auto launch tmux at shell start"; }; config = lib.mkIf cfg.enable {