Use fetchCargoVendor for wasm-bindgen-cli#377534
Conversation
4f0e2d3 to
6b455c7
Compare
6b455c7 to
8d42f8d
Compare
|
--------- Report for 'x86_64-linux' --------- |
alois31
left a comment
There was a problem hiding this comment.
Code looks good save for two nits. The new FOD hashes verify. I think the API is reasonable: it avoids the correctness issue of the old one, while not creating significantly more effort for users: using versions that are already in nixpkgs actually becomes easier (and there is slightly less duplication within nixpkgs too), bumps are pretty much the same effort as before (change the version and two hashes), and new out-of-tree users are not that bad either (a couple of lines more boilerplate, but with better discoverability).
bendlas
left a comment
There was a problem hiding this comment.
lldap still builds and works. approving on behalf of that
8d42f8d to
30a2a1a
Compare
Exposing an overridable cargoHash parameter is problematic because it will produce silently broken FODs if we change the hashing scheme, which we are currently doing across the tree because Cargo 1.84.0 has changed the output of fetchCargoTarball, meaning all hashes have been invalidated. To avoid this happening in future, we are changing to the fetchCargoVendor mechanism, which does not depend on implementation details of Cargo. The future-proof way to override a package with Cargo dependencies is to pass a cargoDeps object. This is more verbose, and requires the caller to have access to the src object for the package. To compensate for this, I've introduced a buildWasmBindgenCli function that is nicer to use than wasm-bindgen-cli.overrideAttrs, and I've also introduced versioned attributes for wasm-bindgen-cli versions currently in use in Nixpkgs, so that each package that wants to use a particular version doesn't have to duplicate the src and cargoDeps definitions for that version. The unversioned "wasm-bindgen-cli" attribute is demoted to an alias, with a view to its eventual removal.
Cargo 1.84.0 seems to have changed the output format of cargo vendor again, once again invalidating fetchCargoTarball FOD hashes. It's time to fix this once and for all, switching across the board to fetchCargoVendor, which is not dependent on cargo vendor's output format.
30a2a1a to
c79f97c
Compare
Exposing an overridable cargoHash parameter is problematic because it
will produce silently broken FODs if we change the hashing scheme,
which we are currently doing across the tree because Cargo 1.84.0 has
changed the output of fetchCargoTarball, meaning all hashes have been
invalidated. To avoid this happening in future, we are changing to
the fetchCargoVendor mechanism, which does not depend on
implementation details of Cargo.
The future-proof way to override a package with Cargo dependencies is
to pass a cargoDeps object. This is more verbose, and requires the
caller to have access to the src object for the package. To
compensate for this, I've introduced a buildWasmBindgenCli function
that is nicer to use than wasm-bindgen-cli.overrideAttrs, and I've
also introduced versioned attributes for wasm-bindgen-cli versions
currently in use in Nixpkgs, so that each package that wants to use a
particular version doesn't have to duplicate the src and cargoDeps
definitions for that version.
This is a bit urgent, because we need the transition to be completed by the end of the current staging-next cycle to avoid exposing broken FODs to users.
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.