crate2nix icon indicating copy to clipboard operation
crate2nix copied to clipboard

environment variable `CARGO_CRATE_NAME` not defined with dep opentelemetry-surf

Open bbigras opened this issue 3 years ago • 4 comments

[dependencies]
opentelemetry-surf = { git = "https://github.com/asaaki/opentelemetry-surf", branch = "main" }
builder for '/nix/store/601g5y6hd9wkz84csgp5915walkgv7ng-rust_opentelemetry-surf-0.1.1.drv' failed with exit code 1; last 10 log lines:
  error: environment variable `CARGO_CRATE_NAME` not defined
    --> src/lib.rs:51:26
     |
  51 | const CRATE_NAME: &str = env!("CARGO_CRATE_NAME");
     |                          ^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

bbigras avatar Dec 07 '20 16:12 bbigras

Any ideas?

bbigras avatar Jan 29 '21 17:01 bbigras

I am surprised this isn't set. But if you set this variable on the derivation in question, then also an env var with that name should be set.

kolloch avatar Jan 30 '21 16:01 kolloch

I think I was able to workaround it by setting CARGO_CRATE_NAME in Cargo.nix.

You should be able to reproduce the problem with just:

[dependencies]
opentelemetry-tide = "0.6"

bbigras avatar Feb 01 '21 20:02 bbigras

Hitting this problem for CARGO_PKG_LICENSE as required by built, fwiw.

nightkr avatar Dec 02 '21 12:12 nightkr