at master 2.9 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 fetchpatch, 7 pkg-config, 8 cython, 9 docutils, 10 setuptools, 11 kivy-garden, 12 libGL, 13 libX11, 14 mtdev, 15 SDL2, 16 SDL2_image, 17 SDL2_ttf, 18 SDL2_mixer, 19 withGstreamer ? true, 20 gst_all_1, 21 pygments, 22 requests, 23 filetype, 24}: 25 26buildPythonPackage rec { 27 pname = "kivy"; 28 version = "2.3.1"; 29 pyproject = true; 30 31 src = fetchFromGitHub { 32 owner = "kivy"; 33 repo = "kivy"; 34 tag = version; 35 hash = "sha256-q8BoF/pUTW2GMKBhNsqWDBto5+nASanWifS9AcNRc8Q="; 36 }; 37 38 patches = [ 39 # Fix compat with newer Cython 40 (fetchpatch { 41 name = "0001-kivy-Remove-old-Python-2-long.patch"; 42 url = "https://github.com/kivy/kivy/commit/5a1b27d7d3bdee6cedb55440bfae9c4e66fb3c68.patch"; 43 hash = "sha256-GDNYL8dC1Rh4KJ8oPiIjegOJGzRQ1CsgWQeAvx9+Rc8="; 44 }) 45 ]; 46 47 postPatch = '' 48 substituteInPlace pyproject.toml \ 49 --replace-fail "setuptools~=69.2.0" "setuptools" \ 50 --replace-fail "wheel~=0.44.0" "wheel" \ 51 --replace-fail "cython>=0.29.1,<=3.0.11" "cython" \ 52 --replace-fail "packaging~=24.0" packaging 53 '' 54 + lib.optionalString stdenv.hostPlatform.isLinux '' 55 substituteInPlace kivy/lib/mtdev.py \ 56 --replace-fail "LoadLibrary('libmtdev.so.1')" "LoadLibrary('${lib.getLib mtdev}/lib/libmtdev.so.1')" 57 ''; 58 59 build-system = [ 60 setuptools 61 cython 62 ]; 63 64 nativeBuildInputs = [ 65 pkg-config 66 ]; 67 68 buildInputs = [ 69 SDL2 70 SDL2_image 71 SDL2_ttf 72 SDL2_mixer 73 ] 74 ++ lib.optionals stdenv.hostPlatform.isLinux [ 75 libGL 76 libX11 77 mtdev 78 ] 79 ++ lib.optionals withGstreamer ( 80 with gst_all_1; 81 [ 82 # NOTE: The degree to which gstreamer actually works is unclear 83 gstreamer 84 gst-plugins-base 85 gst-plugins-good 86 gst-plugins-bad 87 ] 88 ); 89 90 dependencies = [ 91 kivy-garden 92 docutils 93 pygments 94 requests 95 filetype 96 ]; 97 98 env = { 99 KIVY_NO_CONFIG = 1; 100 KIVY_NO_ARGS = 1; 101 KIVY_NO_FILELOG = 1; 102 103 # prefer pkg-config over hardcoded framework paths 104 USE_OSX_FRAMEWORKS = 0; 105 106 # work around python distutils compiling C++ with $CC (see issue #26709) 107 NIX_CFLAGS_COMPILE = toString ( 108 lib.optionals stdenv.cc.isGNU [ 109 "-Wno-error=incompatible-pointer-types" 110 ] 111 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 112 "-I${lib.getInclude stdenv.cc.libcxx}/include/c++/v1" 113 ] 114 ); 115 }; 116 117 /* 118 We cannot run tests as Kivy tries to import itself before being fully 119 installed. 120 */ 121 doCheck = false; 122 pythonImportsCheck = [ "kivy" ]; 123 124 meta = { 125 changelog = "https://github.com/kivy/kivy/releases/tag/${src.tag}"; 126 description = "Library for rapid development of hardware-accelerated multitouch applications"; 127 homepage = "https://github.com/kivy/kivy"; 128 license = lib.licenses.mit; 129 maintainers = with lib.maintainers; [ risson ]; 130 }; 131}