Proto files outside rust project

Hi all. Newbie Nix user looking for some help after spending some hours around this issue.

So I have a few projects that depend on the same proto files. Due to that, the Protos are in a folder outside of each rust project

Internally we have a build.rs which compiles the proto files using the relative path to get to the parent folder and then the /proto folder with it’s contents.

Basically this:

/parent_folder
                          /Project1
                          /Project2
                          /Project3
                          /Protos

I’m trying to use a flake nix in Project1 to build this and of course the proto files are not being moved as they are not included in the project source directly.

And therefore the build fails.

My default nix is something like this:

{ pkgs ? import <nixpkgs> { } }:
let manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
in
pkgs.rustPlatform.buildRustPackage rec {
  pname = manifest.name;
  version = manifest.version;
  cargoLock.lockFile = ./Cargo.lock;
  src = pkgs.lib.cleanSource ./.;
}

I can setup a env variable with a custom path to fetch these Protos from somewhere and use that path in the build.rs instead of the predefined relative path to go to the parent folder and them down to the /proto folder.

I’ve tried with the .to source and then setting that value as the CUSTOM_PROTO_FOLDER but no luck.

src = fs.toSource {
    root = ../.;
    fileset = ./proto;
  };

#And then 

CUSTOM_PROTO_FOLDER = "${src}"

Also don’t know if that is the proper approach or not.

Any help would be greatly appreciated!