nixpkgs/pkgs/games/gogdl/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

67 lines
1.7 KiB
Nix
Raw Normal View History

2022-09-06 09:10:47 +00:00
{ lib
, fetchpatch
2023-05-01 10:07:20 +00:00
, writeScript
2022-09-06 09:10:47 +00:00
, buildPythonApplication
, fetchFromGitHub
, pythonOlder
, setuptools
, requests
2023-05-01 10:07:20 +00:00
, cacert
2022-09-06 09:10:47 +00:00
}:
buildPythonApplication rec {
pname = "gogdl";
2023-07-31 02:43:04 +00:00
version = "0.7.3";
2022-09-06 09:10:47 +00:00
format = "pyproject";
src = fetchFromGitHub {
owner = "Heroic-Games-Launcher";
repo = "heroic-gogdl";
rev = "89d15f1593cc26f15a5f8f409bb623764c095d37";
hash = "sha256-EECpXGVhcwihKB8fLObVvYzFD8uh7CxYKtFiGc0Jqbk=";
2022-09-06 09:10:47 +00:00
};
disabled = pythonOlder "3.8";
propagatedBuildInputs = [
setuptools
requests
];
pythonImportsCheck = [ "gogdl" ];
meta = with lib; {
description = "GOG Downloading module for Heroic Games Launcher";
homepage = "https://github.com/Heroic-Games-Launcher/heroic-gogdl";
license = with licenses; [ gpl3 ];
maintainers = with maintainers; [ aidalgol ];
};
2022-12-28 20:21:51 +00:00
2023-05-01 10:07:20 +00:00
# Upstream no longer create git tags when bumping the version, so we have to
# extract it from the source code on the main branch.
passthru.updateScript = writeScript "gogdl-update-script" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnused jq common-updater-scripts
set -eou pipefail;
owner=Heroic-Games-Launcher
repo=heroic-gogdl
path='gogdl/__init__.py'
version=$(
curl --cacert "${cacert}/etc/ssl/certs/ca-bundle.crt" \
https://raw.githubusercontent.com/$owner/$repo/main/$path |
sed -n 's/^\s*version\s*=\s*"\([0-9]\.[0-9]\.[0-9]\)"\s*$/\1/p')
commit=$(curl --cacert "${cacert}/etc/ssl/certs/ca-bundle.crt" \
https://api.github.com/repos/$owner/$repo/commits?path=$path |
jq -r '.[0].sha')
update-source-version \
${pname} \
"$version" \
--file=./pkgs/games/gogdl/default.nix \
--rev=$commit
'';
2022-09-06 09:10:47 +00:00
}