1{ 2 buildPythonPackage, 3 darwin, 4 fetchFromGitHub, 5 lib, 6 pyobjc-core, 7 setuptools, 8}: 9 10buildPythonPackage rec { 11 pname = "pyobjc-framework-Cocoa"; 12 version = "11.1"; 13 pyproject = true; 14 15 src = fetchFromGitHub { 16 owner = "ronaldoussoren"; 17 repo = "pyobjc"; 18 tag = "v${version}"; 19 hash = "sha256-2qPGJ/1hXf3k8AqVLr02fVIM9ziVG9NMrm3hN1de1Us="; 20 }; 21 22 sourceRoot = "${src.name}/pyobjc-framework-Cocoa"; 23 24 build-system = [ setuptools ]; 25 26 buildInputs = [ 27 darwin.libffi 28 ]; 29 30 nativeBuildInputs = [ 31 darwin.DarwinTools # sw_vers 32 ]; 33 34 # See https://github.com/ronaldoussoren/pyobjc/pull/641. Unfortunately, we 35 # cannot just pull that diff with fetchpatch due to https://discourse.nixos.org/t/how-to-apply-patches-with-sourceroot/59727. 36 postPatch = '' 37 substituteInPlace pyobjc_setup.py \ 38 --replace-fail "-buildversion" "-buildVersion" \ 39 --replace-fail "-productversion" "-productVersion" \ 40 --replace-fail "/usr/bin/sw_vers" "sw_vers" \ 41 --replace-fail "/usr/bin/xcrun" "xcrun" 42 ''; 43 44 dependencies = [ pyobjc-core ]; 45 46 env.NIX_CFLAGS_COMPILE = toString [ 47 "-I${darwin.libffi.dev}/include" 48 "-Wno-error=unused-command-line-argument" 49 ]; 50 51 pythonImportsCheck = [ 52 "Cocoa" 53 "CoreFoundation" 54 "Foundation" 55 "AppKit" 56 "PyObjCTools" 57 ]; 58 59 meta = with lib; { 60 description = "PyObjC wrappers for the Cocoa frameworks on macOS"; 61 homepage = "https://github.com/ronaldoussoren/pyobjc"; 62 license = licenses.mit; 63 platforms = platforms.darwin; 64 maintainers = with maintainers; [ samuela ]; 65 }; 66}