Skip to content

Commit 73794b4

Browse files
authored
ecwolf: add passthru.updateScript (#289653)
2 parents 2f45789 + 10ac919 commit 73794b4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pkgs/games/ecwolf/default.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
, SDL2_net
1212
, SDL2_mixer
1313
, gtk3
14+
, writers
15+
, python3Packages
16+
, nix-update
1417
}:
1518

1619
stdenv.mkDerivation rec {
@@ -40,6 +43,33 @@ stdenv.mkDerivation rec {
4043
makeWrapper $out/{Applications/ecwolf.app/Contents/MacOS,bin}/ecwolf
4144
'';
4245

46+
passthru.updateScript = let
47+
updateScriptPkg = writers.writePython3 "ecwolf_update_script" {
48+
libraries = with python3Packages; [ debian-inspector requests ];
49+
} ''
50+
from os import execl
51+
from sys import argv
52+
53+
from debian_inspector.debcon import get_paragraphs_data
54+
from requests import get
55+
56+
# The debian.drdteam.org repo is a primary source of information. It’s
57+
# run by Blzut3, the creator and primary developer of ECWolf. It’s also
58+
# listed on ECWolf’s download page:
59+
# <https://maniacsvault.net/ecwolf/download.php>.
60+
url = 'https://debian.drdteam.org/dists/stable/multiverse/binary-amd64/Packages' # noqa: E501
61+
response = get(url)
62+
packages = get_paragraphs_data(response.text)
63+
for package in packages:
64+
if package['package'] == 'ecwolf':
65+
latest_version = package['version']
66+
break
67+
nix_update_path = argv[1]
68+
69+
execl(nix_update_path, nix_update_path, '--version', latest_version)
70+
'';
71+
in [ updateScriptPkg (lib.getExe nix-update) ];
72+
4373
meta = with lib; {
4474
description = "Enhanched SDL-based port of Wolfenstein 3D for various platforms";
4575
mainProgram = "ecwolf";

0 commit comments

Comments
 (0)