diff --git a/hosts/common/default.nix b/hosts/common/default.nix index 956daa9..d7c6e64 100644 --- a/hosts/common/default.nix +++ b/hosts/common/default.nix @@ -80,9 +80,17 @@ programs.bash = { enable = true; interactiveShellInit = '' - if [[ $- == *i* ]] && [[ -z "''${M3_SHELL_TO_NU:-}" ]]; then - export M3_SHELL_TO_NU=1 - exec ${pkgs.nushell}/bin/nu --login + # Interactive bash -> nushell, unless started deliberately from + # nu/bash (parent check — an exported env marker would leak into + # zellij/zed/herdr children). Non-interactive bash (ssh command + # exec, Mosh app bootstrap) stays bash. + if [[ $- == *i* ]]; then + parent="" + [[ -r /proc/$PPID/comm ]] && IFS= read -r parent < /proc/$PPID/comm + if [[ "$parent" != "nu" && "$parent" != "bash" ]]; then + exec ${pkgs.nushell}/bin/nu --login + fi + unset parent fi ''; };