diff options
author | Tom Fitzhenry <tom@tom-fitzhenry.me.uk> | 2023-10-03 00:12:24 +1100 |
---|---|---|
committer | Tom Fitzhenry <tom@tom-fitzhenry.me.uk> | 2023-10-03 00:13:59 +1100 |
commit | 8199e4ffcc7447e03e1efa4019cca876accac029 (patch) | |
tree | 0a07058b6df4214391694a9ffd7cba813863970a /pkgs/games/sgt-puzzles | |
parent | bd26f6ed5ea883b8fef7633f4d8c9c7e9be33378 (diff) |
sgt-puzzles: add updateScript
sgt-puzzles updates are available from a static URL, which HTTP redirects to a git-commit based URL. This commit uses that according to https://nixos.org/manual/nixpkgs/unstable/#var-passthru-updateScript
Diffstat (limited to 'pkgs/games/sgt-puzzles')
-rw-r--r-- | pkgs/games/sgt-puzzles/default.nix | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pkgs/games/sgt-puzzles/default.nix b/pkgs/games/sgt-puzzles/default.nix index 5902579b73b1e..a161d8d68ef77 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"; |