From 1ba70151efdb84c48661064f25d1d4002a29ca89 Mon Sep 17 00:00:00 2001 From: m3ta-chiron Date: Sun, 23 Aug 2026 14:35:18 +0200 Subject: [PATCH] refactor(shell): move bash->nushell wrapper to common Default login shell is now bash for all hosts; interactive bash sessions exec into nushell via /etc/bashrc. A ~/.bashrc sourcing /etc/bashrc covers non-login interactive shells (terminal emulators). Non-interactive SSH exec (mosh app bootstrap, scripts) keeps POSIX shell semantics. Reverts the kratos-host-specific overlay from 765ae15. --- hosts/common/default.nix | 11 ++++++++++- hosts/common/users/m3tam3re.nix | 3 +++ hosts/m3-kratos/configuration.nix | 6 ------ hosts/m3-kratos/programs.nix | 13 ------------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/hosts/common/default.nix b/hosts/common/default.nix index a3cb03a..956daa9 100644 --- a/hosts/common/default.nix +++ b/hosts/common/default.nix @@ -76,5 +76,14 @@ ((lib.filterAttrs (_: lib.isType "flake")) inputs); nixPath = ["/etc/nix/path"]; }; - users.defaultUserShell = pkgs.nushell; + users.defaultUserShell = pkgs.bashInteractive; + 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 + fi + ''; + }; } diff --git a/hosts/common/users/m3tam3re.nix b/hosts/common/users/m3tam3re.nix index b5694fb..c40e6b3 100644 --- a/hosts/common/users/m3tam3re.nix +++ b/hosts/common/users/m3tam3re.nix @@ -236,6 +236,9 @@ in { # ── Home-Manager configuration via m3ta-home ── home-manager.users.m3tam3re = { + home.file.".bashrc".text = '' + . /etc/bashrc + ''; imports = [ # Load m3ta-home composition engine diff --git a/hosts/m3-kratos/configuration.nix b/hosts/m3-kratos/configuration.nix index 3688d8f..36d6ea9 100644 --- a/hosts/m3-kratos/configuration.nix +++ b/hosts/m3-kratos/configuration.nix @@ -70,12 +70,6 @@ # Define a user account. Don't forget to set a password with ‘passwd’. - # bash as login shell wrapper: non-interactive SSH clients (e.g. the - # Android Mosh app bootstrap, which runs `command -v mosh-server`) - # need POSIX shell semantics. Interactive login sessions exec into - # nushell automatically — see programs.bash in ./programs.nix. - users.users.m3tam3re.shell = pkgs.bashInteractive; - # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [neovim git]; diff --git a/hosts/m3-kratos/programs.nix b/hosts/m3-kratos/programs.nix index 6820e59..e07905c 100644 --- a/hosts/m3-kratos/programs.nix +++ b/hosts/m3-kratos/programs.nix @@ -32,19 +32,6 @@ ]; }; programs.fish.enable = true; - # Login shell is bash (see configuration.nix), but interactive login - # sessions exec straight into nushell. Non-interactive SSH commands - # (e.g. the Android Mosh app bootstrap `command -v mosh-server`) - # stay in bash where POSIX shell semantics work. - programs.bash = { - enable = true; - interactiveShellInit = '' - if [[ $- == *i* ]] && shopt -q login_shell && [[ -z "''${M3_SHELL_TO_NU:-}" ]]; then - export M3_SHELL_TO_NU=1 - exec ${pkgs.nushell}/bin/nu --login - fi - ''; - }; programs.thunar = { enable = true; plugins = with pkgs; [thunar-archive-plugin thunar-volman];