buildRustPackage fails to download prebuild binary

It’s my first time packaging a rust package.

{
  lib,
  rustPlatform,
  fetchFromGitHub,
  pkg-config,
  openssl,
}: rustPlatform.buildRustPackage (finalAttrs: {
  pname = "patent";
  version = "0.1.0";

  src = fetchFromGitHub {
    owner = "r14dd";
    repo = "patent";
    rev = "v${finalAttrs.version}";
    hash = "sha256-MJNCq/KmEnm8ipqsD8A2TJiwekKiB2Qz+zOW8Ov8MHU=";
  };

  nativeBuildInputs = [
    pkg-config
  ];
  buildInputs = [
    openssl
  ];

  cargoHash = "sha256-lBwtjaaXkSnu/CqeS4wEdKpXwiFSfu96CTBquKZQPVA=";

  meta = with lib; {
    description = "Prior-art search for code ideas across open-source registries";
    homepage = "https://github.com/r14dd/patent";
    license = with licenses; [ mit asl20 ];
    maintainers = with lib.maintainers; [ tomasriveral ];
    platforms = platforms.all;
    mainProgram = "patent";
  };
})

This derivation gives me the error:

> error: ort-sys@2.0.0-rc.12: ort-sys failed to download prebuilt binaries from `https://cdn.pyke.io/0/pyke:ort-rs/ms@1.24.2/x86_64-unknown-linux-gnu.tar.lzma2`: io: failed to lookup address information: Temporary failure in name resolution
> error: build script logged errors

My first thought was that ort-sys just had a problem. Some people report similar issues (Download errors due to certificate: UnknownIssuer · Issue #587 · pykeio/ort · GitHub).

But I tried building the project manually without a nix derivation and it worked fine. I even downloaded with my browser the problematic link and it did fine.

I guess it’s a sandboxing issue. But how could I resolve it?

This may be of use, the project you are building uses fastembed-rs, which has a default feature to download ort binaries, which as you note is not allowed in the sandbox.