dream2nix
dream2nix copied to clipboard
How to build pip package from source that requires rust toolchain
Howdy :wave:
I'm trying to add object-store-python as a dependency that will build from source as they haven't released a new pypi version. Is this possible with the current pip module? I've tried adding an override with cargo but it doesn't seem to get picked up.
Collecting object-store-python@ https://github.com/roeap/object-store-python/archive/6144879f3061f298122b28318bcad0a7d4001d09.zip#subdirectory=object-store
Using cached https://github.com/roeap/object-store-python/archive/6144879f3061f298122b28318bcad0a7d4001d09.zip
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Cargo, the Rust package manager, is not installed or is not on PATH.
This package requires Rust and Cargo to compile extensions. Install it through
the system's package manager or via https://rustup.rs/
Checking for Rust toolchain....
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
deps = {
nixpkgs,
self,
...
}: {
stdenv = nixpkgs.stdenv;
python = nixpkgs.python312;
cargo = nixpkgs.cargo;
};
pip = {
requirementsList =
pyproject.build-system.requires
or []
++ pyproject.project.dependencies
++ lib.optionals (config.flags.groupDev) pyproject.project.optional-dependencies.dev;
flattenDependencies = true;
overrideAll.deps.python = lib.mkForce config.deps.python;
overrides = {
object-store-python.mkDerivation = {
buildInputs = [
config.deps.cargo
];
};
};