Jakub Sokołowski 0311983751
ci: upgrade Nix from 2.3.12 to 2.6.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.
We default to multi-user for Darwin, but not for any other OS due to
discovered issues with `nix-daemon` socket on Arch and open file limits.

I also rewrote `nix/scripts/setup.sh` and `/nix/scripts/purge.sh` to support
different types of installations. Both single-user and multi-user, as some
operating systems have issues with multi-user installations.

Resolves: https://github.com/status-im/status-react/issues/12832
Depends on: https://github.com/status-im/status-jenkins-lib/pull/37

Related changes:
* https://github.com/status-im/infra-ci/commit/84947b9f
* https://github.com/status-im/infra-ci/commit/bb98f5f3
* https://github.com/status-im/infra-ci/commit/f75d524d
* https://github.com/status-im/infra-ci/commit/d1fc92cd
* https://github.com/status-im/infra-ci/commit/87c4091e
* https://github.com/status-im/infra-ci/commit/8d6b6b3f
* https://github.com/status-im/infra-ci/commit/c4f13285
* https://github.com/status-im/infra-ci/commit/38ac698d

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-04-11 12:26:54 +02:00

38 lines
913 B
Bash
Executable File

#!/usr/bin/env bash
# Checking group ownership to identify installation type.
file_group() {
UNAME=$(uname -s)
if [[ "${UNAME}" == "Linux" ]]; then
stat -Lc "%G" "${1}" 2>/dev/null
elif [[ "${UNAME}" == "Darwin" ]]; then
stat -Lf "%Sg" "${1}" 2>/dev/null
fi
}
os_name() {
source /etc/os-release 2>/dev/null
echo "${NAME}"
}
is_arch_linux() {
[[ -f /etc/arch-release ]]
}
nix_install_type() {
NIX_STORE_DIR_GROUP=$(file_group /nix/store)
if [[ "$(os_name)" =~ NixOS ]]; then
echo "nixos"
elif [[ "${NIX_STORE_DIR_GROUP}" == "nixbld" ]]; then
echo "multi"
elif [[ "${NIX_STORE_DIR_GROUP}" == "${USER}" ]]; then
echo "single"
elif [[ "${NIX_STORE_DIR_GROUP}" == "" ]]; then
echo "No Nix installtion detected!" >&2
echo "none"
else
echo "Unknown Nix installtion type!" >&2
exit 1
fi
}