run-tests.sh: fix building tests for Nix ≥ 2.15
This commit is contained in:
parent
bb2e88cec2
commit
e658209d56
1 changed files with 21 additions and 1 deletions
|
|
@ -232,6 +232,8 @@ nixInstantiate() {
|
||||||
|
|
||||||
nixBuild() {
|
nixBuild() {
|
||||||
local outLinkName=$1
|
local outLinkName=$1
|
||||||
|
local drv=$2
|
||||||
|
shift
|
||||||
shift
|
shift
|
||||||
args=(--print-out-paths -L)
|
args=(--print-out-paths -L)
|
||||||
if [[ $outLinkPrefix ]]; then
|
if [[ $outLinkPrefix ]]; then
|
||||||
|
|
@ -239,7 +241,25 @@ nixBuild() {
|
||||||
else
|
else
|
||||||
args+=(--no-link)
|
args+=(--no-link)
|
||||||
fi
|
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() {
|
flake() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue