1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-30 22:20:59 +01:00

Flip condition on daemon version for structured attrs

We want the old behavior, since this is Nix 2.3.
This commit is contained in:
John Ericson 2021-11-30 05:54:12 +00:00
parent 7358292924
commit ac295a5f33
2 changed files with 13 additions and 2 deletions

View file

@ -121,6 +121,13 @@ if [[ $(uname) == Linux ]] && [[ -L /proc/self/ns/user ]] && unshare --user true
_canUseSandbox=1 _canUseSandbox=1
fi fi
isDaemonOlder () {
[[ -n "${NIX_DAEMON_PACKAGE:-}" ]] || return 0
local requiredVersion="$1"
local daemonVersion=$($NIX_DAEMON_PACKAGE/bin/nix-daemon --version | cut -d' ' -f3)
[[ $(nix eval --expr "builtins.compareVersions ''$daemonVersion'' ''$requiredVersion''") -lt 0 ]]
}
isDaemonNewer () { isDaemonNewer () {
[[ -n "${NIX_DAEMON_PACKAGE:-}" ]] || return 0 [[ -n "${NIX_DAEMON_PACKAGE:-}" ]] || return 0
local requiredVersion="$1" local requiredVersion="$1"
@ -128,6 +135,10 @@ isDaemonNewer () {
[[ $(nix eval --expr "builtins.compareVersions ''$daemonVersion'' ''$requiredVersion''") -ge 0 ]] [[ $(nix eval --expr "builtins.compareVersions ''$daemonVersion'' ''$requiredVersion''") -ge 0 ]]
} }
requireDaemonOlderThan () {
isDaemonOlder "$1" || exit 99
}
requireDaemonNewerThan () { requireDaemonNewerThan () {
isDaemonNewer "$1" || exit 99 isDaemonNewer "$1" || exit 99
} }

View file

@ -1,8 +1,8 @@
source common.sh source common.sh
# 27ce722638 required some incompatible changes to the nix file, so skip this # 27ce722638 required some incompatible changes to the nix file, so skip this
# tests for the older versions # tests for the newer versions
requireDaemonNewerThan "2.4pre20210622" requireDaemonOlderThan "2.4pre20210622"
clearStore clearStore