-
Notifications
You must be signed in to change notification settings - Fork 985
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 <jakub@status.im>
- Loading branch information
Showing
16 changed files
with
197 additions
and
110 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Checking group ownership to identify installation type. | ||
file_group() { | ||
UNAME=$(uname -s) | ||
if [[ "${UNAME}" == "Linux" ]]; then | ||
stat -Lc "%G" /nix/store 2>/dev/null | ||
elif [[ "${UNAME}" == "Darwin" ]]; then | ||
stat -Lf "%Sg" /nix/store 2>/dev/null | ||
fi | ||
} | ||
|
||
nix_install_type() { | ||
source /etc/os-release 2>/dev/null | ||
NIX_STORE_DIR_GROUP=$(file_group /nix) | ||
if [[ "${NAME}" =~ NixOS ]]; then | ||
echo "nixos" | ||
elif [[ "${NIX_STORE_DIR_GROUP}" == "nixbld" ]]; then | ||
echo "multi" | ||
elif [[ "${NIX_STORE_DIR_GROUP}" == "${USER}" ]]; then | ||
echo "single" | ||
else | ||
echo "Unknown Nix installtion type!" >&2 | ||
exit 1 | ||
fi | ||
} |
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,24 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script removes all Nix files. | ||
set -e | ||
|
||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel) | ||
source "${GIT_ROOT}/scripts/colors.sh" | ||
|
||
# Purging /nix on NixOS would be disasterous | ||
if [[ -f "/etc/os-release" ]]; then | ||
OS_NAME=$(awk -F= '/^NAME/{print $2}' /etc/os-release) | ||
if [[ "$OS_NAME" == "NixOS" ]]; then | ||
echo -e "${RED}You should not purge Nix files on NixOS!${RST}" >&2 | ||
exit | ||
fi | ||
fi | ||
source "${GIT_ROOT}/scripts/lib.sh" | ||
|
||
NIX_ROOT="/nix" | ||
if [[ $(uname -s) == "Darwin" ]]; then | ||
# Special case due to read-only root on MacOS Catalina | ||
NIX_ROOT="/opt/nix" | ||
fi | ||
if [[ -z "${NIX_ROOT}" ]]; then | ||
echo -e "${RED}Unable to identify Nix root!${RST}" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Purging /nix on NixOS would be disasterous | ||
if [[ "${NIX_INSTALL_TYPE}" == "nixops" ]]; then | ||
echo -e "${RED}You should not purge Nix files on NixOS!${RST}" >&2 | ||
exit | ||
if [[ "${NIX_INSTALL_TYPE}" == "multi" ]]; then | ||
echo -e "${YLW}Detected multi-user Nix installation.${RST}" >&2 | ||
sudo systemctl stop nix-daemon.socket | ||
sudo systemctl stop nix-daemon.service | ||
sudo systemctl disable nix-daemon.socket | ||
sudo systemctl disable nix-daemon.service | ||
sudo systemctl daemon-reload | ||
fi | ||
sudo rm -rf ${NIX_ROOT} \ | ||
/etc/nix ~/.config/nixpkgs \ | ||
~/.nix-profile ~/.nix-defexpr \ | ||
~/.nix-channels ~/.cache/nix \ | ||
~/.status .nix-gcroots | ||
|
||
sudo rm -rf ${NIX_ROOT}/* ~/.nix-profile ~/.nix-defexpr ~/.nix-channels ~/.cache/nix ~/.status .nix-gcroots | ||
echo -e "${GRN}Purged all Nix files from your system.${RST}" >&2 |
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.