From 31fd02ba4aaf4f44af940b535bdaa19010bb7d58 Mon Sep 17 00:00:00 2001 From: Zhong Jianxin Date: Mon, 18 Oct 2021 21:25:02 +0800 Subject: [PATCH] Run shell as login shell So shell rc files (.profile/.bashrc/.zshrc/...) will be loaded --- modules/environment/login/login-inner.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/environment/login/login-inner.nix b/modules/environment/login/login-inner.nix index 015ce70..6e7bfeb 100644 --- a/modules/environment/login/login-inner.nix +++ b/modules/environment/login/login-inner.nix @@ -68,12 +68,13 @@ writeText "login-inner" '' exec /usr/bin/env bash # otherwise it'll be a limited bash that came with Nix ''} + usershell="${config.user.shell}" if [ "$#" -gt 0 ]; then # if script is not called from within nix-on-droid app exec /usr/bin/env "$@" - elif [ -x "${config.user.shell}" ]; then - exec "${config.user.shell}" + elif [ -x "$usershell" ]; then + exec -a "-''${usershell##*/}" "$usershell" else echo "Cannot execute shell '${config.user.shell}', falling back to bash" - exec /usr/bin/env bash + exec -l bash fi ''