Customizing a rust build by passing another derivation as its dependency

I’m struggling to build a rust package, most of the time these used to be very easy but starkcli is proving a little troublesome. from a very basic standpoint I tried:

{ lib
, darwin
, fetchFromGitHub
, fetchurl
, rustPlatform
, rustfmt
, stdenv

rustPlatform.buildRustPackage rec {
  pname = "starkli";
  version = "0.1.11";

  doCheck = false;

  buildInputs = lib.optional stdenv.isDarwin [

  src = fetchFromGitHub {
    owner = "xJonathanLEI";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-mIcjYP3t0L7M5F6LfQrc3MYGXWItNlzOuG3X8N/eIW8=";

  cargoLock = {
    lockFile = ./Cargo.lock;
    allowBuiltinFetchGit = true;

  cargoDepsName = pname;

  meta = with lib; {
    description = "CLI tool for Starknet ";
    homepage = "";
    license =;
    maintainers = [ ];

This is failing with

Caused by:
  failed to parse manifest at `/build/cargo-vendor-dir/cairo-lang-parser-2.1.0/Cargo.toml`

Caused by:
  error inheriting `version` from workspace root manifest's `workspace.package.version`

I understand this is a cargo issue, but I can actually build cairo-lang separately, its even on nixpkgs

btw I’m not on latest nixpkgs:

$ nix eval -f nix/pkgs.nix rustc.version

Now the real question is, can I use the built rust package from nixpkgs (or another derivation) instead of letting this pull it from git and fail due to the workspace issue? I’m also wondering if this is possible to override a dependency version (I understand the risks) and provide a derivation as its source instead of git since its already built

I tried a few things bellow:

  newline = "\n";

  prePatch = ''
    substituteInPlace Cargo.toml \
      --replace 'package = "cairo-lang-starknet", git = "", tag = "v2.1.0"' 'path = "${cairo-lang.src}/"' 

    substituteInPlace Cargo.lock \
      --replace '${newline}source = "git+"' ""

even tried copying the Cargo.lock file and using cargoLock but not much luck so far. I’m not as familiar with the rust toolchain hence any help is appriciated

upon further investigation I’m starting to believe depending on a workspace is not supported in my version of rust toolchain hence the first issue. So either will need to use a newer toolchain or override the Cargo.toml file to split our all the members of the workspace