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:
+2
-16
@@ -39,22 +39,8 @@ if [[ $forceRun ]] && ! git diff --quiet ../flake.{nix,lock}; then
|
||||
exit 1
|
||||
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'"
|
||||
nix flake update $nixUpdateArg ../test/nixos-search
|
||||
nix flake update --flake ../test/nixos-search
|
||||
echo
|
||||
|
||||
versions=$(nix eval --json -f update-flake.nix versions)
|
||||
@@ -66,7 +52,7 @@ echo "Updating main flake"
|
||||
if [[ $nixosVersion ]]; then
|
||||
sed -Ei "s|(nixpkgs.url = .*nixos-)[^\"]+|\1$nixosVersion|" ../flake.nix
|
||||
fi
|
||||
nix flake update $nixUpdateArg ..
|
||||
nix flake update --flake ..
|
||||
|
||||
echo
|
||||
nix eval --raw -f update-flake.nix --argstr prevVersions "$versions" showUpdates; echo
|
||||
|
||||
Reference in New Issue
Block a user