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