nixpkgs/pkgs/development/python-modules/pygame/default.nix
2020-12-07 23:59:58 +00:00

49 lines
1.3 KiB
Nix

{ lib, fetchPypi, buildPythonPackage, python, pkg-config, libX11
, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, libpng, libjpeg, portmidi, freetype
}:
buildPythonPackage rec {
pname = "pygame";
version = "2.0.0";
src = fetchPypi {
inherit pname version;
sha256 = "63b038da116a643046181b02173fd894d87d2f85ecfd6aa7d5ece73c6ef501e9";
};
nativeBuildInputs = [
pkg-config SDL2
];
buildInputs = [
SDL2 SDL2_image SDL2_mixer SDL2_ttf libpng libjpeg
portmidi libX11 freetype
];
# Tests fail because of no audio device and display.
doCheck = false;
preConfigure = ''
sed \
-e "s/origincdirs = .*/origincdirs = []/" \
-e "s/origlibdirs = .*/origlibdirs = []/" \
-e "/linux-gnu/d" \
-i buildconfig/config_unix.py
${lib.concatMapStrings (dep: ''
sed \
-e "/origincdirs =/a\ origincdirs += ['${lib.getDev dep}/include']" \
-e "/origlibdirs =/a\ origlibdirs += ['${lib.getLib dep}/lib']" \
-i buildconfig/config_unix.py
'') buildInputs
}
LOCALBASE=/ ${python.interpreter} buildconfig/config.py
'';
meta = with lib; {
description = "Python library for games";
homepage = "http://www.pygame.org/";
license = licenses.lgpl21Plus;
platforms = platforms.linux;
};
}