1{ 2 buildPythonPackage, 3 cython, 4 fetchFromGitHub, 5 lib, 6 libjpeg, 7 libpng, 8 nix-update-script, 9 SDL2, 10 SDL2_image, 11 SDL2_mixer, 12 SDL2_ttf, 13 setuptools, 14}: 15 16buildPythonPackage rec { 17 pname = "pygame-sdl2"; 18 version = "8.4.0.25071206"; 19 pyproject = true; 20 21 src = fetchFromGitHub { 22 owner = "renpy"; 23 repo = "pygame_sdl2"; 24 tag = "renpy-${version}"; 25 hash = "sha256-I4zk19aNfVZstkVDLkwI/TBXliGAqVmOjeQLbRFri8Y="; 26 }; 27 28 build-system = [ 29 cython 30 SDL2 31 setuptools 32 ]; 33 34 dependencies = [ 35 libjpeg 36 libpng 37 SDL2 38 SDL2_image 39 SDL2_mixer 40 SDL2_ttf 41 ]; 42 43 doCheck = true; 44 45 postUnpack = '' 46 substituteInPlace source/setup.py --replace-fail "2.1.0" "${version}" 47 substituteInPlace source/src/pygame_sdl2/version.py --replace-fail "2, 1, 0" "${ 48 builtins.replaceStrings [ "." ] [ ", " ] version 49 }" 50 51 headers=$(mktemp -d) 52 substituteInPlace source/setup.py --replace-fail \ 53 "pathlib.Path(sysconfig.get_paths()['include']) / \"pygame_sdl2\"" \ 54 "pathlib.Path(\"$headers\")" 55 ''; 56 57 postInstall = '' 58 install -Dm644 $headers/* -t $out/include/pygame_sdl2 59 ''; 60 61 passthru.updateScript = nix-update-script { extraArgs = [ "--version-regex=renpy-(.*)" ]; }; 62 63 meta = { 64 description = "Reimplementation of the Pygame API using SDL2 and related libraries"; 65 homepage = "https://github.com/renpy/pygame_sdl2"; 66 license = with lib.licenses; [ 67 lgpl2 68 zlib 69 ]; 70 platforms = lib.platforms.unix; 71 maintainers = with lib.maintainers; [ raskin ]; 72 }; 73}