Add support for different login shells

This commit is contained in:
Tobias Happ 2020-04-24 21:17:52 +02:00 committed by Alexander Sosedkin
parent 4017e1f700
commit ddfcddfebb
2 changed files with 10 additions and 8 deletions

View file

@ -11,9 +11,10 @@ writeText "login-inner" ''
set -eu -o pipefail set -eu -o pipefail
[ "$#" -gt 0 ] || echo "Welcome to Nix-on-Droid!" if [ "$#" -eq 0 ]; then # if script is called from within nix-on-droid app
echo "Welcome to Nix-on-Droid!"
[ "$#" -gt 0 ] || echo "If nothing works, open an issue at https://github.com/t184256/nix-on-droid/issues or try the rescue shell." echo "If nothing works, open an issue at https://github.com/t184256/nix-on-droid/issues or try the rescue shell."
fi
${lib.optionalString config.build.initialBuild '' ${lib.optionalString config.build.initialBuild ''
if [ -e /etc/UNINTIALISED ]; then if [ -e /etc/UNINTIALISED ]; then
@ -63,9 +64,11 @@ writeText "login-inner" ''
. "${config.user.home}/.nix-profile/etc/profile.d/nix-on-droid-session-init.sh" . "${config.user.home}/.nix-profile/etc/profile.d/nix-on-droid-session-init.sh"
set -u set -u
if [ "$#" -eq 0 ]; then if [ "$#" -gt 0 ]; then # if script is not called from within nix-on-droid app
exec /usr/bin/env bash
else
exec /usr/bin/env "$@" exec /usr/bin/env "$@"
elif [ -x "${config.user.shell}" ]; then
exec "${config.user.shell}"
else
exec /usr/bin/env bash
fi fi
'' ''

View file

@ -40,7 +40,7 @@ in
shell = mkOption { shell = mkOption {
type = types.path; type = types.path;
readOnly = true; default = "${pkgs.bashInteractive}/bin/bash";
description = "Path to login shell."; description = "Path to login shell.";
}; };
@ -73,7 +73,6 @@ in
user = { user = {
group = "nix-on-droid"; group = "nix-on-droid";
home = "/data/data/com.termux.nix/files/home"; home = "/data/data/com.termux.nix/files/home";
shell = "/bin/sh";
userName = "nix-on-droid"; userName = "nix-on-droid";
}; };