trezor-suite: 24.4.3 -> 24.5.2
[NixPkgs.git] / pkgs / games / gogdl / default.nix
blob91cfe972d9c6e1c2a5517b99b88f9e31e28fb99b
1 { lib
2 , fetchpatch
3 , writeScript
4 , buildPythonApplication
5 , fetchFromGitHub
6 , pythonOlder
7 , setuptools
8 , requests
9 , cacert
12 buildPythonApplication rec {
13   pname = "gogdl";
14   version = "1.0.1";
15   format = "pyproject";
17   src = fetchFromGitHub {
18     owner = "Heroic-Games-Launcher";
19     repo = "heroic-gogdl";
20     rev = "10b4a19e0fbe9bc3db6b9ce3ea49fd17c9f1d37d";
21     hash = "sha256-po9To5WfT0L2j48Q84ygbbIqtTfXP9uQPrl4Uu+CWGk=";
22   };
24   disabled = pythonOlder "3.8";
26   propagatedBuildInputs = [
27     setuptools
28     requests
29   ];
31   pythonImportsCheck = [ "gogdl" ];
33   meta = with lib; {
34     description = "GOG Downloading module for Heroic Games Launcher";
35     mainProgram = "gogdl";
36     homepage = "https://github.com/Heroic-Games-Launcher/heroic-gogdl";
37     license = with licenses; [ gpl3 ];
38     maintainers = with maintainers; [ aidalgol ];
39   };
41   # Upstream no longer create git tags when bumping the version, so we have to
42   # extract it from the source code on the main branch.
43   passthru.updateScript = writeScript "gogdl-update-script" ''
44     #!/usr/bin/env nix-shell
45     #!nix-shell -i bash -p curl gnused jq common-updater-scripts
46     set -eou pipefail;
48     owner=Heroic-Games-Launcher
49     repo=heroic-gogdl
50     path='gogdl/__init__.py'
52     version=$(
53       curl --cacert "${cacert}/etc/ssl/certs/ca-bundle.crt" \
54       https://raw.githubusercontent.com/$owner/$repo/main/$path |
55       sed -n 's/^\s*version\s*=\s*"\([0-9]\.[0-9]\.[0-9]\)"\s*$/\1/p')
57     commit=$(curl --cacert "${cacert}/etc/ssl/certs/ca-bundle.crt" \
58       https://api.github.com/repos/$owner/$repo/commits?path=$path |
59       jq -r '.[0].sha')
61     update-source-version \
62       ${pname} \
63       "$version" \
64       --file=./pkgs/games/gogdl/default.nix \
65       --rev=$commit
66   '';