Can't package rust app using `frida`

Hello, I’m clearly stuck and thought would ask here for help. I’m trying to package mirrord rust app that’s using frida-gum-sys as one of it’s dependencies. If I’m not mistaken this crate is trying to access rustc-link-search, which would normally be fine, but Nix cannot put predownloaded binaries into /usr/local/lib and as the issue is coming from dependency of Mirrord I don’t think setting rustc-link-search with RUSTFLAGS works (for me it doesn’t matter what RUSTFLAGS env I use, the search path is always /build/cargo-vendor-dir/frida-gum-sys-0.8.1).
Now, if frida devkits cannot be found, build tries to download them from the internet (illegal in Nix), and then build fails with the following error:

warning: frida-gum-sys@0.8.1: Frida gum devkit not found, downloading from https://github.com/frida/frida/releases/download/16.0.19/frida-gum-devkit-16.0.19-linux-x86_64.tar.xz

error: failed to run custom build command for frida-gum-sys v0.8.1 (https://github.com/metalbear-co/frida-rust?branch=capstone_remove#f5c12b62)

Caused by:
process didn’t exit successfully: /build/source/target/release/build/frida-gum-sys-0c7609d54d7b85d4/build-script-build (exit status: 101)
— stdout
cargo:rerun-if-changed=build.rs
cargo:rustc-link-search=/build/cargo-vendor-dir/frida-gum-sys-0.8.1
cargo:warning=Frida gum devkit not found, downloading from https://github.com/frida/frida/releases/download/16.0.19/frida-gum-devkit-16.0.19-linux-x86_64.tar.xz

— stderr
thread ‘main’ panicked at /build/cargo-vendor-dir/frida-build-0.2.1/src/lib.rs:59:52:
devkit download request failed: reqwest::Error { kind: Request, url: Url { scheme: “https”, cannot_be_a_base: false, username: “”, password: None, host: Some(Domain(“github.com”)), port: None>
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Any ideas what I can do to make the build succeed? My attempts at packaging it are available at GitHub - nxy7/mirrord-nix, should be easy to reproduce error with nix run . --impure.

Looking at the build.rs file, the library will only be searched when auto-download feature is not enabled:

Checking other other crates in the repo, the feature should be disabled by default.

According to Cargo.lock file of the project you are packaging, frida-gum is required by mirrord-layer and looking at its Cargo.toml, it is here that the download is forced:

So you will need to patch that.

Thanks a lot for guidance, hopefully I’ll manage to package it now.