From 765ae1581fbafc826fc5b5eb4dea9bb3aefea6e5 Mon Sep 17 00:00:00 2001 From: m3ta-chiron Date: Sun, 23 Aug 2026 14:24:43 +0200 Subject: [PATCH] fix(kratos): make Android Mosh app work with nushell login shell The old Android Mosh app discovers mosh-server via POSIX shell idioms (command -v / type) through the user's login shell. Nushell has no command/type builtins and which prints a table, so the app reported 'mosh-server Not Found' on kratos (user shell: nu) while working on hermes (app logs in as bash user). Fix: use bash as login shell on kratos and exec into nushell for interactive login sessions via programs.bash.interactiveShellInit. Non-interactive SSH exec (app bootstrap, Termux mosh) stays in bash where POSIX semantics work. Also fixes the stale nh flake path (p/nixos -> p/NIX). --- hosts/m3-kratos/configuration.nix | 6 ++++++ hosts/m3-kratos/programs.nix | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/hosts/m3-kratos/configuration.nix b/hosts/m3-kratos/configuration.nix index 36d6ea9..3688d8f 100644 --- a/hosts/m3-kratos/configuration.nix +++ b/hosts/m3-kratos/configuration.nix @@ -70,6 +70,12 @@ # 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 07a8697..6820e59 100644 --- a/hosts/m3-kratos/programs.nix +++ b/hosts/m3-kratos/programs.nix @@ -32,6 +32,19 @@ ]; }; 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]; @@ -46,6 +59,7 @@ enable = true; clean.enable = true; clean.extraArgs = "--keep-since 4d --keep 3"; - flake = "/home/m3tam3re/p/nixos/nixos-config"; + flake = "/home/m3tam3re/p/NIX/nixos-config"; }; + programs.mosh.enable = true; }