update-flake.sh: remove support for Nix < 2.19
Nix 2.24 is the default in NixOS 24.11. This is required by the following commit that uses a `flake update` command syntax only supported by Nix >= 2.19.
This commit is contained in:
parent
ff847d527c
commit
f60a50607d
1 changed files with 2 additions and 16 deletions
|
|
@ -39,22 +39,8 @@ if [[ $forceRun ]] && ! git diff --quiet ../flake.{nix,lock}; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Support Nix >=2.19
|
|
||||||
{
|
|
||||||
versionGreaterThanOrEqual() {
|
|
||||||
[[ $1 != $(echo -e "$1\n$2" | sort -V | head -n1) || $1 == "$2" ]]
|
|
||||||
}
|
|
||||||
nixVersion=$(nix --version | cut -d\ -f 3)
|
|
||||||
if versionGreaterThanOrEqual "$nixVersion" 2.19; then
|
|
||||||
# https://nixos.org/manual/nix/stable/release-notes/rl-2.19#:~:text=nix%20flake%20update
|
|
||||||
nixUpdateArg=--flake
|
|
||||||
else
|
|
||||||
nixUpdateArg=
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Updating flake 'nixos-search'"
|
echo "Updating flake 'nixos-search'"
|
||||||
nix flake update $nixUpdateArg ../test/nixos-search
|
nix flake update --flake ../test/nixos-search
|
||||||
echo
|
echo
|
||||||
|
|
||||||
versions=$(nix eval --json -f update-flake.nix versions)
|
versions=$(nix eval --json -f update-flake.nix versions)
|
||||||
|
|
@ -66,7 +52,7 @@ echo "Updating main flake"
|
||||||
if [[ $nixosVersion ]]; then
|
if [[ $nixosVersion ]]; then
|
||||||
sed -Ei "s|(nixpkgs.url = .*nixos-)[^\"]+|\1$nixosVersion|" ../flake.nix
|
sed -Ei "s|(nixpkgs.url = .*nixos-)[^\"]+|\1$nixosVersion|" ../flake.nix
|
||||||
fi
|
fi
|
||||||
nix flake update $nixUpdateArg ..
|
nix flake update --flake ..
|
||||||
|
|
||||||
echo
|
echo
|
||||||
nix eval --raw -f update-flake.nix --argstr prevVersions "$versions" showUpdates; echo
|
nix eval --raw -f update-flake.nix --argstr prevVersions "$versions" showUpdates; echo
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue