-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustPlatform.cargoSetupHook: fix platform check #260068
Conversation
Cargo will never need to link for the target platform — that'd be for the package being built to do at runtime. Cargo should know about the build and host linkers. This fixes e.g. pkgsCross.musl64.fd from x86_64-linux. Fixes: 67a4f82 ("rust: hooks: fix cross compilation")
This is a setup hook, which means it goes in |
Ah, so we should undo this, and replace |
Hang on, I'm getting my builds caught up to staging. I'll sort it out. |
For any change, please also investigate if |
How do I know if it's the right one? Is there some invocation which was segfaulting before? Or producing the wrong output? If there is some property of these builds that is important to you, please consider adding a test to |
Yes.
I think so. Testing this. |
What was the bug that this PR fixes? |
@Artturin: the dreaded "hooks are not spliced" problem has struck again. |
|
That's only a issue inside the python set with its own hooks
|
Ah, I was thrown off by the title and:
which is a commit not a bug (?) |
They're spliced if you access the hooks directly, but the hook that's finding its way into diff --git a/pkgs/build-support/rust/build-rust-package/default.nix b/pkgs/build-support/rust/build-rust-package/default.nix
index b75d429ef598..e2f8ad40f23f 100644
--- a/pkgs/build-support/rust/build-rust-package/default.nix
+++ b/pkgs/build-support/rust/build-rust-package/default.nix
@@ -114,7 +114,9 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg
patchRegistryDeps = ./patch-registry-deps;
- nativeBuildInputs = nativeBuildInputs ++ lib.optionals auditable [
+ nativeBuildInputs =
+ assert args.pname == "fd" && !(cargoSetupHook?__spliced) -> throw "it is not spliced";
+ nativeBuildInputs ++ lib.optionals auditable [
(buildPackages.cargo-auditable-cargo-wrapper.override {
inherit cargo cargo-auditable;
})
|
Yeah. So this PR is correct at the moment, because our rust hooks aren't spliced. When we get the rust hooks spliced we will need to revert this, however. But until then it's the right change. |
Proof that the rust hooks are not spliced: #263082 (comment) |
context: <NixOS#263019> cargoSetupHook context: <NixOS#260068 (comment)>
Description of changes
Cargo will never need to link for the target platform — that'd be for the package being built to do at runtime. Cargo should know about the build and host linkers.
This fixes e.g. pkgsCross.musl64.fd from x86_64-linux.
Fixes: 67a4f82 ("rust: hooks: fix cross compilation")
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)