crate2nix
crate2nix copied to clipboard
error: attribute 'cargo_web' missing
I was able to use crate2nix on this project. I think I just did a cargo update
.
crate2nix 0.8.0 rustc 1.45.0-nightly (a08c47310 2020-05-07)
❯ nix-build
trace: root_crate is deprecated since crate2nix 0.4. Please use rootCrate instead.
trace: workspace_members is deprecated in crate2nix 0.4. Please use workspaceMembers instead.
error: attribute 'cargo_web' missing, at /home/bbigras/dev/test/Cargo.nix:5861:44
(use '--show-trace' to show detailed location information)
"time 0.2.15" = rec {
crateName = "time";
version = "0.2.15";
edition = "2018";
sha256 = "1hg6zn71c9xb66j1i9wwwasrxapi5zhnnixfxrqngh76s8lhhcz1";
authors = [
"Jacob Pratt <[email protected]>"
];
dependencies = [
{
name = "cfg-if";
packageId = "cfg-if";
}
{
name = "libc";
packageId = "libc";
optional = true;
target = { target, features }: target."unix";
}
{
name = "standback";
packageId = "standback";
usesDefaultFeatures = false;
}
{
name = "stdweb";
packageId = "stdweb";
optional = true;
usesDefaultFeatures = false;
target = { target, features }: target."cargo_web";
}
{
name = "time-macros";
packageId = "time-macros";
}
{
name = "winapi";
packageId = "winapi 0.3.8";
optional = true;
target = { target, features }: target."windows";
features = [ "minwinbase" "minwindef" "timezoneapi" ];
}
];
buildDependencies = [
{
name = "version_check";
packageId = "version_check 0.9.1";
}
];
features = {
"default" = [ "deprecated" "std" ];
"std" = [ "libc" "winapi" "stdweb" "standback/std" ];
};
resolvedDefaultFeatures = [ "default" "deprecated" "libc" "std" "stdweb" "winapi" ];
};
Any progress on this?
Same here. All of v0.7.0
. v0.8.0
. master
fails to build because of missing cargo_web
.
In my case, cargo_web
is required by stdweb
.
{
name = "stdweb";
packageId = "stdweb 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)";
optional = true;
usesDefaultFeatures = false;
target = { target, features }: target."cargo_web";
}
Can you publish an example project that reproduces the issue? It doesn't have to be very minimal nor small. As long as it reproduces the issue that would be sufficient to have a shot at understanding the nature of the issue.
I'll make one.
I'm able to reproduce with an empty project with only:
[dependencies]
time = "0.2.16"
error: attribute 'cargo_web' missing, at /home/bbigras/dev/lab/crate2nix/issue-133/Cargo.nix:620:44
(use '--show-trace' to show detailed location information)
As a temporary workaround I manually add cargo_web = false
to my projects that suffer from this, with a note to myself so I catch it on the git diffs before committing. I'm not an informed-enough developer to offer a sustainable solution or upstream fix, sorry!
complete reproducer: https://github.com/pandaman64/crate2nix-cargoweb
As a temporary workaround I manually add cargo_web = false to my projects
Thanks @shanesveller . I wish I knew that 3 months ago.
It seems that time
crate detects cargo-web by checking cfg(cargo_web)
:
https://github.com/time-rs/time/blob/main/Cargo.toml#L46
Probably generating cargo_web = false
by default is a good idea as time
is widely used.
#141 is a dupe
As a temporary workaround I manually add
cargo_web = false
to my projects that suffer from this, with a note to myself so I catch it on the git diffs before committing. I'm not an informed-enough developer to offer a sustainable solution or upstream fix, sorry!
Trying to build a project of mine with crate2nix
and running into this. Where do I put cargo_web = false
?
You can modify defaultTarget
in Cargo.nix
.
I'm using this patch: https://github.com/pandaman64/oekaki/blob/master/backend/Cargo.nix.patch
feature = ""
is a workarond for #136. This might disable some SIMD optimizations.
It looks like the latest version fixed this issue. Thanks!