From f60a50607db5f421fd50cde3534b1ae7ca5f66af Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 13 Dec 2024 23:21:21 +0100 Subject: [PATCH] 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. --- helper/update-flake.sh | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/helper/update-flake.sh b/helper/update-flake.sh index 002fd0b..2267c69 100755 --- a/helper/update-flake.sh +++ b/helper/update-flake.sh @@ -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