1{ lib 2, buildPythonPackage 3, toPythonModule 4, pythonOlder 5, pythonAtLeast 6, fetchFromGitHub 7, pyparsing 8, opencascade-occt 9, stdenv 10, python 11, cmake 12, swig 13, freetype 14, libGL 15, libGLU 16, libX11 17, six 18, pytest 19, makeFontsConf 20, freefont_ttf 21, Cocoa 22}: 23 24let 25 pythonocc-core-cadquery = toPythonModule (stdenv.mkDerivation { 26 pname = "pythonocc-core-cadquery"; 27 version = "0.18.2"; 28 29 src = fetchFromGitHub { 30 owner = "CadQuery"; 31 repo = "pythonocc-core"; 32 # no proper release to to use, this commit copied from the Anaconda receipe 33 rev = "701e924ae40701cbe6f9992bcbdc2ef22aa9b5ab"; 34 sha256 = "07zmiiw74dyj4v0ar5vqkvk30wzcpjjzbi04nsdk5mnlzslmyi6c"; 35 }; 36 37 nativeBuildInputs = [ 38 cmake 39 swig 40 ]; 41 42 buildInputs = [ 43 python 44 opencascade-occt 45 freetype 46 libGL 47 libGLU 48 libX11 49 ] ++ lib.optionals stdenv.isDarwin [ Cocoa ]; 50 51 propagatedBuildInputs = [ 52 six 53 ]; 54 55 cmakeFlags = [ 56 "-Wno-dev" 57 "-DPYTHONOCC_INSTALL_DIRECTORY=${placeholder "out"}/${python.sitePackages}/OCC" 58 ]; 59 }); 60 61in 62 buildPythonPackage rec { 63 pname = "cadquery"; 64 version = "2.0"; 65 66 src = fetchFromGitHub { 67 owner = "CadQuery"; 68 repo = pname; 69 rev = version; 70 sha256 = "1n63b6cjjrdwdfmwq0zx1xabjnhndk9mgfkm4w7z9ardcfpvg84l"; 71 }; 72 73 buildInputs = [ 74 opencascade-occt 75 ]; 76 77 propagatedBuildInputs = [ 78 pyparsing 79 pythonocc-core-cadquery 80 ]; 81 82 FONTCONFIG_FILE = makeFontsConf { 83 fontDirectories = [ freefont_ttf ]; 84 }; 85 86 nativeCheckInputs = [ 87 pytest 88 ]; 89 90 disabled = pythonOlder "3.6" || pythonAtLeast "3.8"; 91 92 meta = with lib; { 93 description = "Parametric scripting language for creating and traversing CAD models"; 94 homepage = "https://github.com/CadQuery/cadquery"; 95 license = licenses.asl20; 96 maintainers = with maintainers; [ marcus7070 ]; 97 broken = true; 98 }; 99 }