Skip to content
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

makeRustPlatform prevents cargo*Hook from being spliced #263019

Open
ghost opened this issue Oct 23, 2023 · 4 comments
Open

makeRustPlatform prevents cargo*Hook from being spliced #263019

ghost opened this issue Oct 23, 2023 · 4 comments

Comments

@ghost
Copy link

ghost commented Oct 23, 2023

splice.nix walks the packageset attribute tree, but it can't see through invocations of makeRustPlatform (unless they get inherited into the top-level packageset).

To see that this is true, move cargoSetupHook from nativeBuildInputs to buildInputs in build-rust-package/default.nix and run nix-diff on something like pkgsMusl.fd. You'll see that the derivation moves from buildInputs to nativeBuildInputs, but the script is exactly the same, in spite of the fact that cargoSetupHook writes stdenv.{build,host,target}Platform into its output!

The fact that our rust hooks are unspliced has a few consequences which we will simply need to keep in mind until this gets fixed (likely by eliminating rustPlatform):

  1. Unlike all other hooks, the hooks in rust/hooks/default.nix are NOT phase-shifted back one phase. So the changes in rustPlatform.cargoSetupHook: fix platform check #260068 are correct, but as soon as we fix the unspliced hooks, we must undo those changes.
  2. A lot of rust.lib.envVars appears unnecessary, because of the lack of splicing. e.g. rust.lib.envVars: clean up unnecessary variables #260167
@ghost
Copy link
Author

ghost commented Oct 24, 2023

Proof that the rust hooks are not spliced: #263082 (comment)

@kjeremy
Copy link
Contributor

kjeremy commented Oct 31, 2023

@amjoseph-nixpkgs Is there a plan to solve this? I can't seem to work around the python.cryptography issue.

@ghost
Copy link
Author

ghost commented Nov 2, 2023

@amjoseph-nixpkgs Is there a plan to solve this?

Yes.

The plan is:

  1. After 23.11 branches off we will merge make-derivation.nix: lib.warn if drv.__spliced missing #263082. It emits lib.warn lines for unspliced dependencies.
  2. Fix all of the lib.warn lines emitted by nix-instantiate . -A nix-instantiate . -A pkgsCross.armv7l-hf-multiplatform.python3Packages.cryptography.

I believe that once 2 is done, the python3Packages.cryptography issue will either be fixed (most likely), or some other issue will be revealed (possible but unlikely).

If you have spare time you can start on 2 without waiting for 1. Here are the warnings:

trace: warning: derivation ncurses:
                     unspliced build-host dependency ncurses
                       build=x86_64-unknown-linux-gnu
                       host=x86_64-unknown-linux-gnu
                       target=armv7l-unknown-linux-gnueabihf
                       For advice on fixing this, read the comment above the lib.warn that produced this message.

trace: warning: derivation python3:
                     unspliced build-host dependency python3
                       build=x86_64-unknown-linux-gnu
                       host=x86_64-unknown-linux-gnu
                       target=armv7l-unknown-linux-gnueabihf
                       For advice on fixing this, read the comment above the lib.warn that produced this message.

trace: warning: derivation !!no pname!!:
                     unspliced build-host dependency cargo-vendor-normalise
                       build=x86_64-unknown-linux-gnu
                       host=x86_64-unknown-linux-gnu
                       target=armv7l-unknown-linux-gnueabihf
                       For advice on fixing this, read the comment above the lib.warn that produced this message.

trace: warning: derivation !!no pname!!:
                     unspliced build-host dependency armv7l-unknown-linux-gnueabihf-cargo-1.72.1
                       build=x86_64-unknown-linux-gnu
                       host=x86_64-unknown-linux-gnu
                       target=armv7l-unknown-linux-gnueabihf
                       For advice on fixing this, read the comment above the lib.warn that produced this message.

trace: warning: derivation python3:
                     unspliced build-host dependency python3
                       build=x86_64-unknown-linux-gnu
                       host=x86_64-unknown-linux-gnu
                       target=armv7l-unknown-linux-gnueabihf
                       For advice on fixing this, read the comment above the lib.warn that produced this message.

trace: warning: derivation cryptography:
                     unspliced build-host dependency setuptools-rust-setup-hook
                       build=x86_64-unknown-linux-gnu
                       host=armv7l-unknown-linux-gnueabihf
                       target=armv7l-unknown-linux-gnueabihf
                       For advice on fixing this, read the comment above the lib.warn that produced this message.

trace: warning: derivation python3:
                     unspliced build-host dependency python3
                       build=x86_64-unknown-linux-gnu
                       host=x86_64-unknown-linux-gnu
                       target=armv7l-unknown-linux-gnueabihf
                       For advice on fixing this, read the comment above the lib.warn that produced this message.

@kjeremy
Copy link
Contributor

kjeremy commented Nov 2, 2023

I submitted #265060 for ncurses but I think the other ones are beyond me.

uninsane added a commit to uninsane/nixpkgs that referenced this issue Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant