Update login-inner for new initialBuild flag

This commit is contained in:
Tobias Happ 2019-10-04 17:20:16 +02:00
parent 70237f112d
commit c58c8233df
3 changed files with 31 additions and 28 deletions

View file

@ -26,8 +26,6 @@ buildPkgs.runCommand "bootstrap" { } ''
cp ${files.nixConf} $out/etc/nix/nix.conf
cp ${files.resolvConf} $out/etc/resolv.conf
touch $out/etc/UNINTIALISED
find $out -executable -type f | sed s@^$out/@@ > $out/EXECUTABLES.txt
find $out -type l | while read -r LINK; do

View file

@ -1,7 +1,7 @@
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
{ buildPkgs, nixDirectory }:
{ buildPkgs, initialBuild, nixDirectory }:
let
inherit (buildPkgs) writeScript writeText;
@ -11,7 +11,7 @@ let
packageInfo = import "${nixDirectory}/nix-support/package-info.nix";
callPackage = buildPkgs.lib.callPackageWith {
inherit instDir nixDirectory packageInfo writeScript writeText;
inherit initialBuild instDir packageInfo writeScript writeText;
};
in

View file

@ -1,7 +1,7 @@
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
{ instDir, packageInfo, writeText }:
{ initialBuild, instDir, packageInfo, writeText }:
writeText "login-inner" ''
set -e
@ -15,10 +15,12 @@ writeText "login-inner" ''
export HOME="/data/data/com.termux.nix/files/home"
shift
${
if initialBuild
then ''
[ "$#" -gt 0 ] || echo "Sourcing Nix environment..."
. ${packageInfo.nix}/etc/profile.d/nix.sh
if [ -e ${instDir}/etc/UNINTIALISED ]; then
export NIX_SSL_CERT_FILE=${packageInfo.cacert}
echo "Installing and updating nix-channels..."
@ -32,8 +34,6 @@ writeText "login-inner" ''
echo "Setting up static symlinks via nix-on-droid-linker"
nix-on-droid-linker
${packageInfo.coreutils}/bin/rm /etc/UNINTIALISED
echo
echo "Congratulations! Now you have Nix installed with some basic packages like"
echo "bashInteractive, coreutils, cacert and some scripts provided by nix-on-droid"
@ -42,7 +42,12 @@ writeText "login-inner" ''
echo "You can go for the bare Nix setup or you can configure your phone via"
echo "home-manager. For that simply run hm-install."
echo
fi
''
else ''
[ "$#" -gt 0 ] || echo "Sourcing Nix environment..."
. $HOME/.nix-profile/etc/profile.d/nix.sh
''
}
if [ -e "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then
[ "$#" -gt 0 ] || echo "Sourcing home-manager environment..."