ecwolf: add passthru.updateScript (#289653)

This commit is contained in:
Sefa Eyeoglu 2024-11-08 13:21:54 +01:00 committed by GitHub
commit 73794b4d2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,6 +11,9 @@
, SDL2_net
, SDL2_mixer
, gtk3
, writers
, python3Packages
, nix-update
}:
stdenv.mkDerivation rec {
@ -40,6 +43,33 @@ stdenv.mkDerivation rec {
makeWrapper $out/{Applications/ecwolf.app/Contents/MacOS,bin}/ecwolf
'';
passthru.updateScript = let
updateScriptPkg = writers.writePython3 "ecwolf_update_script" {
libraries = with python3Packages; [ debian-inspector requests ];
} ''
from os import execl
from sys import argv
from debian_inspector.debcon import get_paragraphs_data
from requests import get
# The debian.drdteam.org repo is a primary source of information. Its
# run by Blzut3, the creator and primary developer of ECWolf. Its also
# listed on ECWolfs download page:
# <https://maniacsvault.net/ecwolf/download.php>.
url = 'https://debian.drdteam.org/dists/stable/multiverse/binary-amd64/Packages' # noqa: E501
response = get(url)
packages = get_paragraphs_data(response.text)
for package in packages:
if package['package'] == 'ecwolf':
latest_version = package['version']
break
nix_update_path = argv[1]
execl(nix_update_path, nix_update_path, '--version', latest_version)
'';
in [ updateScriptPkg (lib.getExe nix-update) ];
meta = with lib; {
description = "Enhanched SDL-based port of Wolfenstein 3D for various platforms";
mainProgram = "ecwolf";