about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
author7c6f434c <7c6f434c@mail.ru>2023-10-04 17:33:57 +0000
committerGitHub <noreply@github.com>2023-10-04 17:33:57 +0000
commita53084e1a72a82d83ee6d252607dd25150aa0645 (patch)
treec3d3a08868ffd514b98ec6fd237254dd5af9721f /pkgs/games
parent21eae3c0fe39b8ea31b865a21fcd576c821a7b7a (diff)
parent8199e4ffcc7447e03e1efa4019cca876accac029 (diff)
downloadnixlib-a53084e1a72a82d83ee6d252607dd25150aa0645.tar
nixlib-a53084e1a72a82d83ee6d252607dd25150aa0645.tar.gz
nixlib-a53084e1a72a82d83ee6d252607dd25150aa0645.tar.bz2
nixlib-a53084e1a72a82d83ee6d252607dd25150aa0645.tar.lz
nixlib-a53084e1a72a82d83ee6d252607dd25150aa0645.tar.xz
nixlib-a53084e1a72a82d83ee6d252607dd25150aa0645.tar.zst
nixlib-a53084e1a72a82d83ee6d252607dd25150aa0645.zip
Merge pull request #258580 from tomfitzhenry/sgtpuzzles-updatescript
sgt-puzzles: add updateScript
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/sgt-puzzles/default.nix17
1 files changed, 13 insertions, 4 deletions
diff --git a/pkgs/games/sgt-puzzles/default.nix b/pkgs/games/sgt-puzzles/default.nix
index 5902579b73b1..a161d8d68ef7 100644
--- a/pkgs/games/sgt-puzzles/default.nix
+++ b/pkgs/games/sgt-puzzles/default.nix
@@ -1,13 +1,11 @@
 { lib, stdenv, fetchurl, desktop-file-utils
 , gtk3, libX11, cmake, imagemagick
-, pkg-config, perl, wrapGAppsHook, nixosTests
+, pkg-config, perl, wrapGAppsHook, nixosTests, writeScript
 , isMobile ? false
 }:
 
 stdenv.mkDerivation rec {
   pname = "sgt-puzzles";
-  # To find the latest version:
-  #     $ curl -s -i 'https://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles.tar.gz' | grep Location
   version = "20230918.2d9e414";
 
   src = fetchurl {
@@ -61,7 +59,18 @@ stdenv.mkDerivation rec {
     install -Dm644 ${sgt-puzzles-menu} -t $out/etc/xdg/menus/applications-merged/
   '';
 
-  passthru.tests.sgtpuzzles = nixosTests.sgtpuzzles;
+  passthru = {
+    tests.sgtpuzzles = nixosTests.sgtpuzzles;
+    updateScript = writeScript "update-sgtpuzzles" ''
+      #!/usr/bin/env nix-shell
+      #!nix-shell -i bash -p curl pcre common-updater-scripts
+
+      set -eu -o pipefail
+
+      version="$(curl -sI 'https://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles.tar.gz' | grep -Fi Location: | pcregrep -o1 'puzzles-([0-9a-f.]*).tar.gz')"
+      update-source-version sgtpuzzles "$version"
+    '';
+  };
 
   meta = with lib; {
     description = "Simon Tatham's portable puzzle collection";