mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
Fix issues of lazy install of login-inner
If initalisation is done, a new session would result in a reinit as login-inner is not installed. The file /etc/UNINTIALISED helps to prevent this from happening. The same applies to any logic like home-manager sourcing which would only take effect after restarting the app.
This commit is contained in:
parent
e0ee316311
commit
90e5fb2f49
2 changed files with 35 additions and 34 deletions
|
|
@ -39,6 +39,7 @@ with lib;
|
||||||
environment.etc = {
|
environment.etc = {
|
||||||
"group".enable = false;
|
"group".enable = false;
|
||||||
"passwd".enable = false;
|
"passwd".enable = false;
|
||||||
|
"UNINTIALISED".text = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ writeText "login-inner" ''
|
||||||
export GC_NPROCS=1 # to prevent gc warnings of nix, see https://github.com/NixOS/nix/issues/3237
|
export GC_NPROCS=1 # to prevent gc warnings of nix, see https://github.com/NixOS/nix/issues/3237
|
||||||
|
|
||||||
${lib.optionalString config.build.initialBuild ''
|
${lib.optionalString config.build.initialBuild ''
|
||||||
|
if [[ -e /etc/UNINTIALISED ]]; then
|
||||||
echo "Set default user profile..."
|
echo "Set default user profile..."
|
||||||
${nix}/bin/nix-env --switch-profile /nix/var/nix/profiles/per-user/$USER/profile
|
${nix}/bin/nix-env --switch-profile /nix/var/nix/profiles/per-user/$USER/profile
|
||||||
|
|
||||||
|
|
@ -56,18 +57,17 @@ writeText "login-inner" ''
|
||||||
echo "You can go for the bare nix-on-droid setup or you can configure your phone via home-manager. See \
|
echo "You can go for the bare nix-on-droid setup or you can configure your phone via home-manager. See \
|
||||||
config file for further information."
|
config file for further information."
|
||||||
echo
|
echo
|
||||||
|
fi
|
||||||
''}
|
''}
|
||||||
|
|
||||||
[ "$#" -gt 0 ] || echo "Sourcing Nix environment..."
|
[ "$#" -gt 0 ] || echo "Sourcing Nix environment..."
|
||||||
. $HOME/.nix-profile/etc/profile.d/nix.sh
|
. $HOME/.nix-profile/etc/profile.d/nix.sh
|
||||||
|
|
||||||
${lib.optionalString (config.home-manager.config != null) ''
|
|
||||||
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..."
|
||||||
export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:}$NIX_PATH
|
export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:}$NIX_PATH
|
||||||
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||||
fi
|
fi
|
||||||
''}
|
|
||||||
|
|
||||||
# Workaround for https://github.com/NixOS/nix/issues/1865
|
# Workaround for https://github.com/NixOS/nix/issues/1865
|
||||||
export NIX_PATH=nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs/:$NIX_PATH
|
export NIX_PATH=nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs/:$NIX_PATH
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue