1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, torch 5, ninja 6, scipy 7, which 8, pybind11 9, pytest-xdist 10, pytestCheckHook 11}: 12 13let 14 linePatch = '' 15 import os 16 os.environ['PATH'] = os.environ['PATH'] + ':${ninja}/bin' 17 ''; 18in 19buildPythonPackage rec { 20 pname = "deepwave"; 21 version = "0.0.17"; 22 format = "pyproject"; 23 24 src = fetchFromGitHub { 25 owner = "ar4"; 26 repo = pname; 27 rev = "v${version}"; 28 sha256 = "sha256-4B3V87/voYs61pXhqmydLe48JsnRGuJlUYOOdmJlroA="; 29 }; 30 31 # unable to find ninja although it is available, most likely because it looks for its pip version 32 postPatch = '' 33 substituteInPlace setup.cfg --replace "ninja" "" 34 35 # Adding ninja to the path forcibly 36 mv src/deepwave/__init__.py tmp 37 echo "${linePatch}" > src/deepwave/__init__.py 38 cat tmp >> src/deepwave/__init__.py 39 rm tmp 40 ''; 41 42 # The source files are compiled at runtime and cached at the 43 # $HOME/.cache folder, so for the check phase it is needed to 44 # have a temporary home. This is also the reason ninja is not 45 # needed at the nativeBuildInputs, since it will only be used 46 # at runtime. 47 preBuild = '' 48 export HOME=$(mktemp -d) 49 ''; 50 51 propagatedBuildInputs = [ torch pybind11 ]; 52 53 checkInputs = [ 54 which 55 scipy 56 pytest-xdist 57 pytestCheckHook 58 ]; 59 60 pythonImportsCheck = [ "deepwave" ]; 61 62 meta = with lib; { 63 description = "Wave propagation modules for PyTorch"; 64 homepage = "https://github.com/ar4/deepwave"; 65 license = licenses.mit; 66 platforms = intersectLists platforms.x86_64 platforms.linux; 67 maintainers = with maintainers; [ atila ]; 68 }; 69}