summary refs log tree commit diff
diff options
context:
space:
mode:
authorLily Foster <lily@lily.flowers>2023-05-25 19:40:05 -0400
committerGitHub <noreply@github.com>2023-05-25 19:40:05 -0400
commitf864e73325911ccea6f57c704902df476786149a (patch)
tree1d383f29197b424cf35e381aa3b48462c0fc1672
parenta11641f10359b963a54972f1f2b7c573b469b026 (diff)
parentba3e6a91d100d8321bec95b4a1cb6b2abaaa1027 (diff)
downloadnixpkgs-f864e73325911ccea6f57c704902df476786149a.tar
nixpkgs-f864e73325911ccea6f57c704902df476786149a.tar.gz
nixpkgs-f864e73325911ccea6f57c704902df476786149a.tar.bz2
nixpkgs-f864e73325911ccea6f57c704902df476786149a.tar.lz
nixpkgs-f864e73325911ccea6f57c704902df476786149a.tar.xz
nixpkgs-f864e73325911ccea6f57c704902df476786149a.tar.zst
nixpkgs-f864e73325911ccea6f57c704902df476786149a.zip
Merge pull request #233702 from lilyinstarlight/fix/gmic-qt-updatescript
gmic-qt: fix updateScript
-rw-r--r--pkgs/tools/graphics/gmic-qt/default.nix24
1 files changed, 22 insertions, 2 deletions
diff --git a/pkgs/tools/graphics/gmic-qt/default.nix b/pkgs/tools/graphics/gmic-qt/default.nix
index f12a5b4da5c..cb39d340e80 100644
--- a/pkgs/tools/graphics/gmic-qt/default.nix
+++ b/pkgs/tools/graphics/gmic-qt/default.nix
@@ -3,23 +3,27 @@
 , fetchzip
 , cimg
 , cmake
+, coreutils
 , curl
 , fftw
 , gimp
 , gimpPlugins
 , gmic
+, gnugrep
+, gnused
 , graphicsmagick
 , libjpeg
 , libpng
 , libtiff
 , ninja
-, nix-update-script
+, nix-update
 , opencv3
 , openexr
 , pkg-config
 , qtbase
 , qttools
 , wrapQtAppsHook
+, writeShellScript
 , zlib
 , variant ? "standalone"
 }:
@@ -108,7 +112,23 @@ stdenv.mkDerivation (finalAttrs: {
       inherit cimg gmic;
     };
 
-    updateScript = nix-update-script { };
+    updateScript = writeShellScript "gmic-qt-update-script" ''
+      set -euo pipefail
+
+      export PATH="${lib.makeBinPath [ coreutils curl gnugrep gnused nix-update ]}:$PATH"
+
+      latestVersion=$(curl 'https://gmic.eu/files/source/' \
+                       | grep -E 'gmic_[^"]+\.tar\.gz' \
+                       | sed -E 's/.+<a href="gmic_([^"]+)\.tar\.gz".+/\1/g' \
+                       | sort --numeric-sort --reverse | head -n1)
+
+      if [[ '${finalAttrs.version}' = "$latestVersion" ]]; then
+          echo "The new version same as the old version."
+          exit 0
+      fi
+
+      nix-update --version "$latestVersion"
+    '';
   };
 
   meta = {