From 41d5538921e07d291e3f88f6ffaf60d8c2e68daa Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Tue, 21 Mar 2023 08:56:05 -0400 Subject: [PATCH] Fix `maturin build` when using PyPy for the pycddl package --- nix/pycddl.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nix/pycddl.nix b/nix/pycddl.nix index 703f00595..4c68830d4 100644 --- a/nix/pycddl.nix +++ b/nix/pycddl.nix @@ -27,7 +27,7 @@ # # 8. run `nix-build`. it should succeed. if it does not, seek assistance. # -{ lib, fetchPypi, buildPythonPackage, rustPlatform }: +{ lib, fetchPypi, python, buildPythonPackage, rustPlatform }: buildPythonPackage rec { pname = "pycddl"; version = "0.4.0"; @@ -38,6 +38,12 @@ buildPythonPackage rec { sha256 = "sha256-w0CGbPeiXyS74HqZXyiXhvaAMUaIj5onwjl9gWKAjqY="; }; + # Without this, when building for PyPy, `maturin build` seems to fail to + # find the interpreter at all and then fails early in the build process with + # an error saying "unsupported Python interpreter". We can easily point + # directly at the relevant interpreter, so do that. + maturinBuildFlags = [ "--interpreter" python.executable ]; + nativeBuildInputs = with rustPlatform; [ maturinBuildHook cargoSetupHook