From 7be77fffb08e477a8e9e796a7643008bbcc24c83 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Thu, 11 Apr 2019 08:42:00 +0200 Subject: [PATCH] Do not change user's profile with Nix installation Signed-off-by: Pedro Pombeiro --- scripts/lib/setup/installers.sh | 18 ++++-------------- scripts/setup | 12 ------------ 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/scripts/lib/setup/installers.sh b/scripts/lib/setup/installers.sh index ca8cd81286..f7eb139254 100755 --- a/scripts/lib/setup/installers.sh +++ b/scripts/lib/setup/installers.sh @@ -12,22 +12,12 @@ function download_url() { function install_nix() { if ! program_exists nix; then - touch -a "${HOME}/.bash_profile" - 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 - echo -e "${YELLOW}**********************************************************************************************************" - echo "The Nix package manager was successfully installed." - echo -e "**********************************************************************************************************${NC}" - fi + echo -e "${YELLOW}**********************************************************************************************************" + echo "The Nix package manager was successfully installed." + echo -e "**********************************************************************************************************${NC}" else echo "Please see https://nixos.org/nix/manual/#chap-installation" fi diff --git a/scripts/setup b/scripts/setup index 7707174c26..b9aff2672e 100755 --- a/scripts/setup +++ b/scripts/setup @@ -20,18 +20,6 @@ exit_unless_os_supported #### 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 cecho "@b@yellow[[Please install curl before running setup.]]" exit 1