-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: upgrade Nix from 2.3.12 to 2.5.1
Due to changes in how Nix handles Git refs we need to specify `refs/tags/` prefix in `package.json` to avoid the following error: ``` fatal: couldn't find remote ref refs/heads/v2.0.3-status-v6 error: program 'git' failed with exit code 128 ``` I also had to rewrite some logic in `nix/scripts/source.sh` in order to take account of single-user and multi-user installations. Resolves: #12832 Issue: NixOS/nix#5291 Signed-off-by: Jakub Sokołowski <[email protected]>
- Loading branch information
Showing
13 changed files
with
131 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,62 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script makes sure we have Nix tools available | ||
set -e | ||
|
||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel) | ||
|
||
# Location of profile script for Nix that adjusts PATH | ||
export NIX_PROFILE_SH="${HOME}/.nix-profile/etc/profile.d/nix.sh" | ||
|
||
function source_nix() { | ||
# Just stop if Nix is already available | ||
if [[ -x $(command -v nix) ]]; then | ||
return | ||
elif [[ -f "${NIX_PROFILE_SH}" ]]; then | ||
# Load Nix profile if it exists | ||
source "${NIX_PROFILE_SH}" | ||
return | ||
else | ||
file_group() { | ||
UNAME=$(uname -s) | ||
if [[ "${UNAME}" == "Linux" ]]; then | ||
stat -Lc "%G" /nix | ||
elif [[ "${UNAME}" == "Darwin" ]]; then | ||
stat -Lf "%Sg" /nix | ||
fi | ||
} | ||
|
||
nix_install_type() { | ||
NIX_DIR_GROUP=$(file_group /nix) | ||
if [[ "${NIX_DIR_GROUP}" == "nixbld" ]]; then | ||
echo "multi" | ||
elif [[ "${NIX_DIR_GROUP}" == "${USER}" ]]; then | ||
echo "single" | ||
elif [[ "${NIX_DIR_GROUP}" == "${USER}" ]]; then | ||
echo "nixos" | ||
else | ||
echo "Unknown Nix installtion type!" >&2 | ||
exit 1 | ||
fi | ||
} | ||
|
||
source_nix_profile() { | ||
NIX_INSTALL_TYPE=$(nix_install_type) | ||
if [[ "${NIX_INSTALL_TYPE}" == "multi" ]]; then | ||
source "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" | ||
elif [[ "${NIX_INSTALL_TYPE}" == "single" ]]; then | ||
source "${HOME}/.nix-profile/etc/profile.d/nix.sh" | ||
elif [[ "${NIX_INSTALL_TYPE}" == "nixops" ]]; then | ||
echo "Sourcing profile not necessary on NixOS!" >&2 | ||
fi | ||
} | ||
|
||
main() { | ||
# Just stop if Nix is already available | ||
if [[ -x $(command -v nix) ]]; then | ||
return | ||
fi | ||
|
||
# Setup Nix if not available | ||
${GIT_ROOT}/nix/scripts/setup.sh | ||
fi | ||
if [[ ! -d /nix ]]; then | ||
${GIT_ROOT}/nix/scripts/setup.sh | ||
fi | ||
|
||
# Load Nix profile | ||
source "${NIX_PROFILE_SH}" | ||
# Load Nix profile | ||
source_nix_profile | ||
|
||
# Verify Nix is available | ||
if [[ ! -x $(command -v nix) ]]; then | ||
echo "Nix not available, sourcing profile failed!" > /dev/stderr | ||
exit 1 | ||
fi | ||
# Verify Nix is available | ||
if [[ ! -x $(command -v nix) ]]; then | ||
echo "Nix not available, sourcing profile failed!" >&2 | ||
exit 1 | ||
fi | ||
} | ||
|
||
source_nix | ||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.