|
| 1 | +{ |
| 2 | + stdenv, |
| 3 | + lib, |
| 4 | + cmake, |
| 5 | + pkg-config, |
| 6 | + eigen, |
| 7 | + fetchFromGitHub, |
| 8 | + python3Packages, |
| 9 | +}: |
| 10 | + |
| 11 | +stdenv.mkDerivation { |
| 12 | + pname = "eigen3-to-python"; |
| 13 | + version = "1.0.7"; |
| 14 | + |
| 15 | + # pr 35 |
| 16 | + src = fetchFromGitHub { |
| 17 | + owner = "Kooolkimooov"; |
| 18 | + repo = "Eigen3ToPython"; |
| 19 | + rev = "a1dfb35c204b2732d0b60d4d2bb6edb4c6941f59"; |
| 20 | + hash = "sha256-zNaMmaexyDBD2frMkO4z+Qj/AKtIxt6sRdwYcwoNJh8="; |
| 21 | + }; |
| 22 | + |
| 23 | + nativeBuildInputs = [ |
| 24 | + cmake |
| 25 | + pkg-config |
| 26 | + python3Packages.cython |
| 27 | + python3Packages.python |
| 28 | + python3Packages.distutils |
| 29 | + python3Packages.pytest |
| 30 | + python3Packages.pip |
| 31 | + ]; |
| 32 | + |
| 33 | + propagatedBuildInputs = [ |
| 34 | + eigen |
| 35 | + python3Packages.numpy |
| 36 | + ]; |
| 37 | + |
| 38 | + cmakeFlags = [ |
| 39 | + "-DPIP_INSTALL_PREFIX=$out/lib/python3" |
| 40 | + "-DCMAKE_BUILD_TYPE=Release" |
| 41 | + "-DCYTHON_USE_CACHE=OFF" |
| 42 | + ]; |
| 43 | + |
| 44 | + # Force pip to ignore the EXTERNALLY-MANAGED restriction in the sandbox |
| 45 | + PIP_BREAK_SYSTEM_PACKAGES = 1; |
| 46 | + # Force pip to use the Nix-provided python packages instead of checking PyPI |
| 47 | + PIP_NO_BUILD_ISOLATION = 1; |
| 48 | + |
| 49 | + # Force Cython/Python to use the build directory for caching instead of /homeless-shelter |
| 50 | + preBuild = '' |
| 51 | + export HOME=$TMPDIR |
| 52 | + ''; |
| 53 | + |
| 54 | + doCheck = true; |
| 55 | + |
| 56 | + # Override the default CMake install step |
| 57 | + installPhase = '' |
| 58 | + runHook preInstall |
| 59 | +
|
| 60 | + # 1. Define the destination directory inside the Nix store output |
| 61 | + # Using python.sitePackages handles the "lib/python3.13/site-packages" string automatically |
| 62 | + local targetDir="$out/${python3Packages.python.sitePackages}/eigen" |
| 63 | + mkdir -p "$targetDir" |
| 64 | +
|
| 65 | + ls -lR |
| 66 | +
|
| 67 | + # 2. Copy your built files from the build tree to the target store path |
| 68 | + # (Adjust 'build/python/Release/eigen/' path if your build folder structure differs slightly) |
| 69 | + cp -r python/Release/eigen/* "$targetDir" |
| 70 | +
|
| 71 | + runHook postInstall |
| 72 | + ''; |
| 73 | + |
| 74 | + meta = with lib; { |
| 75 | + description = "Provide Eigen3 to numpy conversion"; |
| 76 | + homepage = "https://github.com/jrl-umi3218/Eigen3ToPython"; |
| 77 | + license = licenses.bsd2; |
| 78 | + platforms = platforms.all; |
| 79 | + }; |
| 80 | +} |
0 commit comments