Help to build a rust based package with strange download failure error

Hi all,

I am trying to modify the swayosd package from the repository as it does not install all the file of the package (it misses especially the udev rules).

When I changed the build to rely on the meson scripts included in the original repo I receive the following error:

Found ninja-1.11.1 at /nix/store/vy6qf5ny58a2pr21q1hx4p9hgians0sc-ninja-1.11.1/bin/ninja
meson: enabled parallel building
meson: enabled parallel installing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
build flags: -j16
[0/2] Generating src/cargo-build: swayosd with a custom command
    Updating crates.io index
warning: spurious network error (3 tries remaining): [6] Couldn't resolve host name (Could not resolve host: index.crates.io)
warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (Could not resolve host: index.crates.io)
warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name (Could not resolve host: index.crates.io)
error: failed to get `async-std` as a dependency of package `swayosd v0.1.0 (/build/source)`

Caused by:
  failed to query replaced source registry `crates-io`

Caused by:
  download of config.json failed

Caused by:
  failed to download from `https://index.crates.io/config.json`

Caused by:
  [6] Couldn't resolve host name (Could not resolve host: index.crates.io)
FAILED: src/swayosd
/nix/store/whinz9rj5h6h8zxp9bkmfzv7fkzc0cq8-coreutils-9.3/bin/env CARGO_HOME=/build/source/build/cargo-home /nix/store/hw2xmrqirmrq4f3vl7nbf53ivif8gny7-cargo-1.70.0/bin/cargo build --manifest-path /build/source/Cargo.toml --target-dir /build/sou>
ninja: build stopped: subcommand failed.
l

I have no internet error and the crates index services seems to running correctly.
The code of my update can be found here:

What am I missing here?

There is no network access inside the build sandbox.

When you changed from buildRustPackage to mkDerivation, you cut out the mechanism that uses a separate fixed-output derivation to fetch them before the build:

Thanks for the info.
I was missing a hook to solve that. I have added it and now it works.

1 Like