From e658209d568573a5811c1696de9cffafc099d045 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Wed, 19 Jul 2023 11:37:47 +0200 Subject: [PATCH] =?UTF-8?q?run-tests.sh:=20fix=20building=20tests=20for=20?= =?UTF-8?q?Nix=20=E2=89=A5=202.15?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/run-tests.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/run-tests.sh b/test/run-tests.sh index d26c111..5a69daf 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -232,6 +232,8 @@ nixInstantiate() { nixBuild() { local outLinkName=$1 + local drv=$2 + shift shift args=(--print-out-paths -L) if [[ $outLinkPrefix ]]; then @@ -239,7 +241,25 @@ nixBuild() { else args+=(--no-link) fi - nix build "${args[@]}" "$@" + if isNixVersionGreaterEqual_2_15; then + # This syntax is supported by Nix ≥ 2.13 + drv="$(realpath "$drv")^*" + fi + nix build "$drv" "${args[@]}" "$@" +} + +isNixGE_2_15=undefined +isNixVersionGreaterEqual_2_15() { + if [[ $isNixGE_2_15 == undefined ]]; then + isNixGE_2_15= + if { + echo '2.15' + nix --version | awk '{print $NF}' + } | sort -C -V; then + isNixGE_2_15=1 + fi + fi + [[ $isNixGE_2_15 ]] } flake() {