Do not change user's profile with Nix installation
Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
parent
59823d4bea
commit
7be77fffb0
|
@ -12,22 +12,12 @@ function download_url() {
|
||||||
|
|
||||||
function install_nix() {
|
function install_nix() {
|
||||||
if ! program_exists nix; then
|
if ! program_exists nix; then
|
||||||
touch -a "${HOME}/.bash_profile"
|
|
||||||
|
|
||||||
local required_version=$(toolversion nix)
|
local required_version=$(toolversion nix)
|
||||||
bash <(curl https://nixos.org/releases/nix/nix-${required_version}/install) --no-daemon
|
NIX_INSTALLER_NO_MODIFY_PROFILE=1 bash <(curl https://nixos.org/releases/nix/nix-${required_version}/install) --no-daemon
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
if is_linux && [ -f ~/.bashrc ] && ! grep -qF ".nix-profile/etc/profile.d/nix.sh" ~/.bashrc; then
|
|
||||||
# For some reason, new terminals are not started as login shells, so .profile and .bash_profile are not sourced.
|
|
||||||
# To get around it, we add Nix initialization to .bashrc as well, if it exists
|
|
||||||
echo "if [ -e ${HOME}/.nix-profile/etc/profile.d/nix.sh ]; then . ${HOME}/.nix-profile/etc/profile.d/nix.sh; fi # added by Status' setup script" >> ~/.bashrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo -e "${YELLOW}**********************************************************************************************************"
|
echo -e "${YELLOW}**********************************************************************************************************"
|
||||||
echo "The Nix package manager was successfully installed."
|
echo "The Nix package manager was successfully installed."
|
||||||
echo -e "**********************************************************************************************************${NC}"
|
echo -e "**********************************************************************************************************${NC}"
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo "Please see https://nixos.org/nix/manual/#chap-installation"
|
echo "Please see https://nixos.org/nix/manual/#chap-installation"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -20,18 +20,6 @@ exit_unless_os_supported
|
||||||
####
|
####
|
||||||
setup_header "Checking prerequisites..."
|
setup_header "Checking prerequisites..."
|
||||||
|
|
||||||
if program_exists nix; then
|
|
||||||
if [ -z "$IN_NIX_SHELL" ]; then
|
|
||||||
if is_nixos; then
|
|
||||||
cecho "@b@yellow[[All's good, you can run 'make shell' now]]"
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
cecho "@b@red[[Please run 'make shell' first]]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! program_exists "curl"; then
|
if ! program_exists "curl"; then
|
||||||
cecho "@b@yellow[[Please install curl before running setup.]]"
|
cecho "@b@yellow[[Please install curl before running setup.]]"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in New Issue