test/nixos-search: fix running flake-info in an offline environment

This commit is contained in:
Erik Arvstedt 2024-07-18 20:45:50 +02:00
parent 3cc6010658
commit 5d0907b064
No known key found for this signature in database
GPG key ID: 33312B944DD97846
3 changed files with 30 additions and 4 deletions

View file

@ -3,13 +3,19 @@ set -euo pipefail
cd "${BASH_SOURCE[0]%/*}"
nbFlake=$(realpath ../..)
# Use cachix to cache the `flake-info` build
cachixCache=nix-bitcoin
nix run .#cachix -- use "$cachixCache"
# shellcheck disable=SC2016
PATH=$(nix shell -L .#flake-info .#cachix -c sh -c 'echo $PATH')
PATH=$(nix shell -L .#{flake-info,cachix,jq} -c sh -c 'echo $PATH')
# flake-info uses `nixpkgs` from NIX_PATH
NIX_PATH="nixpkgs=$(nix flake metadata --json --inputs-from "$nbFlake" nixpkgs | jq -r .path)"
export NIX_PATH
if [[ ${CACHIX_SIGNING_KEY:-} ]]; then
cachix push "$cachixCache" "$(type -P flake-info)";