status-react/nix/scripts/gcroots.sh
Jakub Sokołowski c5df51d944
nix: upgrade from 2.13.4 to 2.19.3
We are moving location of symlinks for build derivations for `gcroots`
from `/nix/var/nix/gcroots/per-user` to `.nix-gcroots` in the repo to
avoid errors like this caused by profile migration in `2.14` release:
```
error: creating directory '/nix/var/nix/gcroots/per-user/joe': Permission denied
```
For more details see: https://github.com/NixOS/nix/issues/8564

To upgrade without using `make nix-purge` use `make nix-upgrade`.

Related infra change:
https://github.com/status-im/infra-ci/commit/37c6ce47

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2024-02-13 13:32:50 +01:00

23 lines
624 B
Bash
Executable File

#!/usr/bin/env bash
set -Ee
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
source "${GIT_ROOT}/nix/scripts/source.sh"
source "${GIT_ROOT}/scripts/colors.sh"
_NIX_GCROOTS="${_NIX_GCROOTS:-${GIT_ROOT}/.nix-gcroots}"
TARGET="${1}"
shift
if [[ -z "${TARGET}" ]]; then
echo -e "${RED}No target specified for gcroots.sh!${RST}" >&2
exit 1
fi
# Creates a symlink to derivation in _NIX_GCROOTS directory.
# This prevents it from being removed by 'gc-collect-garbage'.
nix-instantiate --attr "${TARGET}" \
--add-root "${_NIX_GCROOTS}/${TARGET}" \
"${@}" "${GIT_ROOT}/default.nix" >/dev/null