rustPlatform.buildRustPackage: fix cargoDeps inherited attribute overriding#435239
rustPlatform.buildRustPackage: fix cargoDeps inherited attribute overriding#435239ShamrockLee wants to merge 1 commit intoNixOS:masterfrom
Conversation
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/is-it-possible-to-override-cargosha256-in-buildrustpackage/4393/28 |
|
@ofborg build lixStatic |
|
|
|
|
|
axelkar
left a comment
There was a problem hiding this comment.
Code looks good, I haven't tested it though.
| RUSTFLAGS = "-C split-debuginfo=packed " + (args.RUSTFLAGS or ""); | ||
| } | ||
| // { | ||
| name = args.name or "${finalAttrs.pname}-${finalAttrs.version}"; |
There was a problem hiding this comment.
Do you think it would be possible to just skip this?
| name = args.name or "${finalAttrs.pname}-${finalAttrs.version}"; | |
| # empty, effectively same as: `inherit (finalAttrs) name;` |
There was a problem hiding this comment.
Yes. We should let stdenv.mkDerivation handle the name-related attributes whenever pissible.
There was a problem hiding this comment.
Update:
No. We need it to define cargoName's default value.
The path changing of scuba and nnd reminds me of the glitches. They both uses pkgsStatic or pkgsCross, which appends platform names to name if specified and pname otherwise.
There was a problem hiding this comment.
Second update:
You are right. Let's inherit name, pname and version from the main package's finalAttrs and specify custom name for cargoDeps only when cargoDepsName is specified non-null.
There was a problem hiding this comment.
The path change turns out to be inevitable due to how rustPlatform.fetchCargoVendor handle the names. It needs to add prefixes to its name, and changing this behavior results in mass rebuilds.
Luckly, we can keep our current simplification.
|
@ShamrockLee What is the state of this PR? Why is it a draft? This PR looks reasonable to me. I think it is pretty close to fixing #415397. On the basis of this PR, just changing let
pkgs = import <nixpkgs> { config = { }; overlays = [ ]; };
in
{
kanataBumped = pkgs.kanata.overrideAttrs (old: {
version = assert old.version != "1.10.1"; "1.10.1";
src = old.src.overrideAttrs {
hash = "sha256-jzTK/ZK9UrXTP/Ow662ENBv3cim6klA8+DQv4DLVSNU=";
};
cargoHash = "sha256-qYFt/oHokR+EznugEaE/ZEn26IFVLXePgoYGxoPRi+g=";
});
} |
I was waiting for the depending PR, and forgot to mark it ready for review after rebasing. Edit: It turns out I haven't rebased it yet. Update: Rebased. |
eb0312e to
a1d15dc
Compare
|
GitHub connection seems somewhat unstable currently. CI checks in some of my PRs fail due to network issues. |
…riding Make `<rust-package>.cargoDeps` reference the overridden `<rust-package>.src` and other attributes. Let `stdenv.mkDerivation` handle the name of `<rust-package>.cargoDeps`. Make Rust package overriding *possible* before making further design decisions about the `<pkg>.overrideAttrs` interface.
a1d15dc to
04c3e0d
Compare
axelkar
left a comment
There was a problem hiding this comment.
The code looks looks great, but I haven't tested it.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/overriding-version-cant-find-new-cargohash/31502/10 |
Make .cargoDeps reference the overridden .src and other attributes.
Make Rust package overriding possible before making further design decisions about the
<pkg>.overrideAttrsinterface.This is an initial effort to fixe #415397
This PR depends on:
unpackPhaseandcargoDeps.unpackPhase#435278After rebasing onto it, this PR should cause no rebuild.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.