Jakub Sokołowski 46bd2b2e4c
cleanup of shell scripts
Changes:
- Add missing lazy assignment for OS_NAME, fixes double Nix shells
- Moved `scripts/add-nix-gcroots.sh` to `nix/scripts/gcroots.sh`
- Moved Nix package manager setup to `nix/scripts/setup.sh`
- Created `nix/scripts/source.sh` to reuse in all Nix scripts
- Created `STARTING_GUIDE.md` with instructions for contributors
- Created `scripts/colors.sh` for definition of shell colors
- Removed `scripts/setup` in favor of `nix/scripts/setup.sh`
- Removed all of `scripts/lib` since it was useless

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-02-24 19:31:55 +01:00

27 lines
666 B
Bash
Executable File

#!/usr/bin/env bash
# This script makes sure we have Nix tools available
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
function source_nix() {
# Just stop if Nix is already available
if [[ -x $(command -v nix) ]]; then
return
elif [[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]]; then
# Load Nix profile if it exists
source "${HOME}/.nix-profile/etc/profile.d/nix.sh"
else
# Setup Nix if not available
${GIT_ROOT}/nix/scripts/setup.sh
fi
# Verify Nix is available
if [[ ! -x $(command -v nix) ]]; then
echo "Nix not available, sourcing profile failed!" > /dev/stderr
exit 1
fi
}
source_nix