From ddfcddfebbe1f4ed051586b893bde3621132f607 Mon Sep 17 00:00:00 2001 From: Tobias Happ Date: Fri, 24 Apr 2020 21:17:52 +0200 Subject: [PATCH] Add support for different login shells --- modules/environment/login/login-inner.nix | 15 +++++++++------ modules/user.nix | 3 +-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/environment/login/login-inner.nix b/modules/environment/login/login-inner.nix index a9682d0..fbb2aaa 100644 --- a/modules/environment/login/login-inner.nix +++ b/modules/environment/login/login-inner.nix @@ -11,9 +11,10 @@ writeText "login-inner" '' set -eu -o pipefail - [ "$#" -gt 0 ] || 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." + if [ "$#" -eq 0 ]; then # if script is called from within nix-on-droid app + echo "Welcome to Nix-on-Droid!" + 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 '' 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" set -u - if [ "$#" -eq 0 ]; then - exec /usr/bin/env bash - else + 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}" + else + exec /usr/bin/env bash fi '' diff --git a/modules/user.nix b/modules/user.nix index 5daf898..bee58aa 100644 --- a/modules/user.nix +++ b/modules/user.nix @@ -40,7 +40,7 @@ in shell = mkOption { type = types.path; - readOnly = true; + default = "${pkgs.bashInteractive}/bin/bash"; description = "Path to login shell."; }; @@ -73,7 +73,6 @@ in user = { group = "nix-on-droid"; home = "/data/data/com.termux.nix/files/home"; - shell = "/bin/sh"; userName = "nix-on-droid"; };