mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
Add source nix.sh and hm-session-vars.sh in session-init.sh
This commit is contained in:
parent
7f2331bb02
commit
4017e1f700
3 changed files with 23 additions and 23 deletions
|
|
@ -4,11 +4,6 @@
|
|||
|
||||
let
|
||||
inherit (customPkgs.packageInfo) cacert coreutils nix;
|
||||
|
||||
sessionInitPackage =
|
||||
if config.build.initialBuild
|
||||
then config.build.sessionInit
|
||||
else "/nix/var/nix/profiles/per-user/${config.user.userName}/profile";
|
||||
in
|
||||
|
||||
writeText "login-inner" ''
|
||||
|
|
@ -20,12 +15,14 @@ writeText "login-inner" ''
|
|||
|
||||
[ "$#" -gt 0 ] || echo "If nothing works, open an issue at https://github.com/t184256/nix-on-droid/issues or try the rescue shell."
|
||||
|
||||
set +u
|
||||
. "${sessionInitPackage}/etc/profile.d/nix-on-droid-session-init.sh"
|
||||
set -u
|
||||
|
||||
${lib.optionalString config.build.initialBuild ''
|
||||
if [ -e /etc/UNINTIALISED ]; then
|
||||
export HOME="${config.user.home}"
|
||||
export USER="${config.user.userName}"
|
||||
|
||||
# To prevent gc warnings of nix, see https://github.com/NixOS/nix/issues/3237
|
||||
export GC_NPROCS=1
|
||||
|
||||
echo "Setting default user profile..."
|
||||
${nix}/bin/nix-env --switch-profile /nix/var/nix/profiles/per-user/$USER/profile
|
||||
|
||||
|
|
@ -62,19 +59,9 @@ writeText "login-inner" ''
|
|||
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
|
||||
[ "$#" -gt 0 ] || echo "Sourcing home-manager environment..."
|
||||
export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:}$NIX_PATH
|
||||
set +u
|
||||
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
set -u
|
||||
fi
|
||||
|
||||
# Workaround for https://github.com/NixOS/nix/issues/1865
|
||||
export NIX_PATH=nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs/:$NIX_PATH
|
||||
set +u
|
||||
. "${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
|
||||
|
|
|
|||
|
|
@ -19,6 +19,20 @@ let
|
|||
[ -n "$__NOD_SESS_INIT_SOURCED" ] && return
|
||||
export __NOD_SESS_INIT_SOURCED=1
|
||||
|
||||
. $HOME/.nix-profile/etc/profile.d/nix.sh
|
||||
|
||||
${optionalString (config.home-manager.config != null) ''
|
||||
if [ -e "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then
|
||||
export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:}$NIX_PATH
|
||||
set +u
|
||||
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
set -u
|
||||
fi
|
||||
''}
|
||||
|
||||
# Workaround for https://github.com/NixOS/nix/issues/1865
|
||||
export NIX_PATH=nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs/:$NIX_PATH
|
||||
|
||||
${exportAll cfg.sessionVariables}
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ let
|
|||
|
||||
prootTermuxClosure = closureInfo {
|
||||
rootPaths = [
|
||||
config.build.sessionInit
|
||||
prootTermux
|
||||
];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue