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.nixConf} $out/etc/nix/nix.conf
cp ${files.resolvConf} $out/etc/resolv.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 -executable -type f | sed s@^$out/@@ > $out/EXECUTABLES.txt
find $out -type l | while read -r LINK; do 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. # Licensed under GNU Lesser General Public License v3 or later, see COPYING.
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS. # Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
{ buildPkgs, nixDirectory }: { buildPkgs, initialBuild, nixDirectory }:
let let
inherit (buildPkgs) writeScript writeText; inherit (buildPkgs) writeScript writeText;
@ -11,7 +11,7 @@ let
packageInfo = import "${nixDirectory}/nix-support/package-info.nix"; packageInfo = import "${nixDirectory}/nix-support/package-info.nix";
callPackage = buildPkgs.lib.callPackageWith { callPackage = buildPkgs.lib.callPackageWith {
inherit instDir nixDirectory packageInfo writeScript writeText; inherit initialBuild instDir packageInfo writeScript writeText;
}; };
in in

View file

@ -1,7 +1,7 @@
# Licensed under GNU Lesser General Public License v3 or later, see COPYING. # Licensed under GNU Lesser General Public License v3 or later, see COPYING.
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS. # Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
{ instDir, packageInfo, writeText }: { initialBuild, instDir, packageInfo, writeText }:
writeText "login-inner" '' writeText "login-inner" ''
set -e set -e
@ -15,34 +15,39 @@ writeText "login-inner" ''
export HOME="/data/data/com.termux.nix/files/home" export HOME="/data/data/com.termux.nix/files/home"
shift shift
[ "$#" -gt 0 ] || echo "Sourcing Nix environment..." ${
. ${packageInfo.nix}/etc/profile.d/nix.sh 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}
export NIX_SSL_CERT_FILE=${packageInfo.cacert}
echo "Installing and updating nix-channels..." echo "Installing and updating nix-channels..."
${packageInfo.nix}/bin/nix-channel --add https://nixos.org/channels/nixos-19.03 nixpkgs ${packageInfo.nix}/bin/nix-channel --add https://nixos.org/channels/nixos-19.03 nixpkgs
${packageInfo.nix}/bin/nix-channel --add https://github.com/t184256/nix-on-droid-bootstrap/archive/master.tar.gz nix-on-droid ${packageInfo.nix}/bin/nix-channel --add https://github.com/t184256/nix-on-droid-bootstrap/archive/master.tar.gz nix-on-droid
${packageInfo.nix}/bin/nix-channel --update ${packageInfo.nix}/bin/nix-channel --update
echo "Installing nix-on-droid.basic-environment..." echo "Installing nix-on-droid.basic-environment..."
${packageInfo.nix}/bin/nix-env -iA nix-on-droid.basic-environment ${packageInfo.nix}/bin/nix-env -iA nix-on-droid.basic-environment
echo "Setting up static symlinks via nix-on-droid-linker" echo "Setting up static symlinks via nix-on-droid-linker"
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 echo "bashInteractive, coreutils, cacert and some scripts provided by nix-on-droid"
echo "Congratulations! Now you have Nix installed with some basic packages like" echo "itself."
echo "bashInteractive, coreutils, cacert and some scripts provided by nix-on-droid" echo
echo "itself." echo "You can go for the bare Nix setup or you can configure your phone via"
echo echo "home-manager. For that simply run hm-install."
echo "You can go for the bare Nix setup or you can configure your phone via" echo
echo "home-manager. For that simply run hm-install." ''
echo else ''
fi [ "$#" -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 if [ -e "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then
[ "$#" -gt 0 ] || echo "Sourcing home-manager environment..." [ "$#" -gt 0 ] || echo "Sourcing home-manager environment..."