1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

checks: add /etc/profile check from bootstrap script

This commit is contained in:
Daiderd Jordan 2018-01-13 19:44:26 +01:00
parent 8bffb9877e
commit f6b9e43a84
No known key found for this signature in database
GPG key ID: D02435D05B810C96
2 changed files with 17 additions and 6 deletions

View file

@ -211,12 +211,6 @@ install(){
fi
fi
if grep -q 'etc/profile.d/nix-daemon.sh' /etc/profile; then
echo -e ""$RED"WARNING: Detected nix-daemon.sh in /etc/profile."
echo "This will override environment variables configured by nix-darwin,"
echo "you might want to remove that."
fi
# Finish
echo -e ""$GREEN"You're all done!"$ESC""
echo -e "Take a look at "$YELLOW"~/.nixpkgs/darwin-configuration.nix"$ESC" to get started."

View file

@ -53,6 +53,22 @@ let
esac
'';
nixInstaller = ''
if grep -q 'etc/profile.d/nix-daemon.sh' /etc/profile; then
echo "error: Found nix-daemon.sh reference in /etc/profile, aborting activation" >&2
echo "This will override options like nix.nixPath because it runs later," >&2
echo "remove this snippet from /etc/profile:" >&2
echo >&2
echo " # Nix" >&2
echo " if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then" >&2
echo " . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'" >&2
echo " fi" >&2
echo " # End Nix" >&2
echo >&2
exit 2
fi
'';
nixPath = ''
darwinConfig=$(NIX_PATH=${concatStringsSep ":" config.nix.nixPath} nix-instantiate --eval -E '<darwin-config>' || echo '$HOME/.nixpkgs/darwin-configuration.nix') || true
if ! test -e "$darwinConfig"; then
@ -104,6 +120,7 @@ in
${darwinChanges}
${buildUsers}
${nixChannels}
${nixInstaller}
${nixPath}
if test ''${checkActivation:-0} -eq 1; then