Hi there, I would like to package a private repo which is a C++ project built with CMake but has some rust code as a FFI brought in using Corrosion and cxx-rs. Im struggling to bring in the rust crate dependencies.
I have tried building from a minimal example project which i forked found here: GitHub - MattCairns/rusty_cmake: Rust cmake integration template with corrosion and cxx
cxx-rs is available in nixPkgs but im not sure if/how i could leverage that package. Any help packaging this would be much appreciated!
Here is my nix:
{ stdenv
, fetchFromGitHub
, cmake
, pkg-config
, corrosion
, cargo
, rustc
, cxx-rs
, rustPlatform
}:
stdenv.mkDerivation rec {
pname = "rusty_cmake";
version = "main";
src = fetchFromGitHub {
owner = "mattcairns";
repo = "${pname}";
rev = "${version}";
hash = "sha256-g8hxq9kNn7XH8yqxlUXtBoXgV4ezLBjAHxZrVUJbCgI=";
};
# cargoDeps = rustPlatform.importCargoLock {
# lockFile = source/src/rusty_code/Cargo.lock;
# };
# Somehow download the cxx crate and cxx-build crates and move them to build dir?
# cxxRustDeps = rustPlatform.fetchCargoTarball {
# inherit src;
# name = "cxx";
# hash = "";
# };
nativeBuildInputs = [
cmake
pkg-config
corrosion
cargo
rustc
cxx-rs
];
doCheck = true;
}