github.com/status-im/status-go@v1.1.0/nix/scripts/gcroots.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -Ee
     4  
     5  GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
     6  source "${GIT_ROOT}/nix/scripts/source.sh"
     7  source "${GIT_ROOT}/scripts/colors.sh"
     8  
     9  _NIX_GCROOTS="${_NIX_GCROOTS:-${GIT_ROOT}/.nix-gcroots}"
    10  
    11  TARGET="${1}"
    12  shift
    13  if [[ -z "${TARGET}" ]]; then
    14      echo -e "${RED}No target specified for gcroots.sh!${RST}" >&2
    15      exit 1
    16  fi
    17  
    18  # Creates a symlink to derivation in _NIX_GCROOTS directory.
    19  # This prevents it from being removed by 'gc-collect-garbage'.
    20  nix-instantiate --add-root "${_NIX_GCROOTS}/${TARGET}" \
    21      "${@}" "${GIT_ROOT}/shell.nix" >/dev/null