nix-community / crate2nix

rebuild only changed crates in CI with crate2nix and nix
https://nix-community.github.io/crate2nix/
Apache License 2.0
354 stars 83 forks source link

cargo-features not applied #247

Closed 573 closed 1 year ago

573 commented 2 years ago

Using the following overlay:

self: super: rec {
  crate2nix-tools =
      import ((builtins.fetchTarball sources.crate2nix.url) + "/tools.nix")
      {};
  nil-src =
      import
      (crate2nix-tools.generatedCargoNix {
        name = "nil";
        src = builtins.fetchTarball sources.nil.url;
      })
      {
      inherit super; rootFeatures = ["edition2021"];
      };
  nil = nil-src.rootCrate.build;
}

I still end up getting:

@nix { "action": "setPhase", "phase": "unpackPhase" } unpacking sources unpacking source archive /nix/store/0krjcwvk4fdcxjl1is0iqx0y1iz9f5vj-source source root is source @nix { "action": "setPhase", "phase": "buildPhase" } building ++ crate2nix generate -f ./Cargo.toml -o Cargo-generated.nix -h /nix/store/qwv4hzwvaspk593acq8fxwacllp5dp09-nil-crate2nix/crate-hashes.json Error: while retrieving metadata about ./Cargo.toml: cargo metadata exited with an error: error: failed to parse manifest at /tmp/nix-build-nil-crate2nix.drv-0/source/Cargo.toml

Caused by: feature edition2021 is required

The package requires the Cargo feature called edition2021, but that feature is not stabilized in this version of Cargo (1.55.0). Consider adding cargo-features = ["edition2021"] to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature. See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2021 for more information about the status of this feature. crate2nix failed. == cargo/config (BEGIN) [source.crates-io] replace-with = "vendored-sources"

[source.vendored-sources] directory = "/nix/store/5hfa2xaankyls5cha7w1nf3rlvrypnzw-deps"

== cargo/config (END)

== crate-hashes.json (BEGIN) {} == crate-hashes.json (END)

== ls -la (BEGIN) total 72 drwxr-xr-x 5 nixbld1 nixbld 4096 Jan 1 1970 . drwx------ 3 nixbld1 nixbld 4096 Aug 1 11:39 .. -rw-r--r-- 1 nixbld1 nixbld 16 Jan 1 1970 .gitignore -rw-r--r-- 1 nixbld1 nixbld 18721 Jan 1 1970 Cargo.lock -rw-r--r-- 1 nixbld1 nixbld 404 Jan 1 1970 Cargo.toml -rw-r--r-- 1 nixbld1 nixbld 10850 Jan 1 1970 LICENSE-APACHE -rw-r--r-- 1 nixbld1 nixbld 1023 Jan 1 1970 LICENSE-MIT -rw-r--r-- 1 nixbld1 nixbld 631 Jan 1 1970 README.md drwxr-xr-x 3 nixbld1 nixbld 4096 Jan 1 1970 lsp -rw-r--r-- 1 nixbld1 nixbld 2936 Jan 1 1970 shell.nix drwxr-xr-x 4 nixbld1 nixbld 4096 Jan 1 1970 src drwxr-xr-x 4 nixbld1 nixbld 4096 Jan 1 1970 syntax == ls -la (END)

573 commented 1 year ago

Using https://github.com/oxalica/rust-overlay should help here.