Jakub Sokołowski 68722340c9
nix: add missing args to gcroots.sh script
This should fix the following error showing up on MacOS:
```
error: assertion ((__lessThan  0)  ((builtins).stringLength  watchmanSockPath))
failed at /Users/jenkins/repos/status-react/nix/mobile/android/watchman.nix:8:9
```
Which was caused by flags like `--argstr` not being passed.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-08-06 15:12:37 +02:00

23 lines
650 B
Bash
Executable File

#!/usr/bin/env bash
set -Ee
_NIX_GCROOTS="${_NIX_GCROOTS:-/nix/var/nix/gcroots/per-user/${USER}/status-react}"
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
source "${GIT_ROOT}/nix/scripts/source.sh"
source "${GIT_ROOT}/scripts/colors.sh"
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