-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
python-cryptography: fix cross #226120
python-cryptography: fix cross #226120
Conversation
- setuptools-rust and rustPlatform.cargoSetupHook has been moved from nativeBuildInputs to buildInputs. - rustPlatform seems to interfere with splicing, so rustc and cargo are now top-level parameters in order to facilitate that. - Two environment variables need to be passed explicitly: - CARGO_BUILD_TARGET because otherwise the final link step attempts to use the hostPlatform linker - PYO3_CROSS_LIB_DIR because without it pyo3 throws a fit.
@ofborg build pkgsCross.aarch64-multiplatform.python3Packages.cryptography |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prefix for python packages is python310Packages.cryptography or python310.pkgs.cryptography.
This definitely must go to staging.
setuptools-rust | ||
rustPlatform.cargoSetupHook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setuptools is consumed by the python that is building as far as I know. setup hooks also usually go to nativeBuildInputs. I assume the hooks themselves require some fixes to fix this properly.
@@ -21,6 +21,11 @@ | |||
, py | |||
, pytz | |||
, hypothesis | |||
, buildPackages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
, buildPackages |
cargo | ||
rustc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we used rustPlaform to make sure all the rust things fit together. Can you describe the problem why you have split this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rustPlatform
breaks splicing, which is why #212795 needs that actually #212795 does the same thing.CARGO_BUILD_TARGET
hack.
We should stop using rustPlatform.cargo
and rustPlatform.rustc
. The splicing magic only seems to work for arguments that are passed directly rather than by reference through an attrset.
@Artturin can probably explain this better, he actually understands it while I just pretend to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be similar to #211340 but it's not the issue here because those attrs are spliced correctly pkgsCross.aarch64-multiplatform.__splicedPackages.rustPlatform.rust.rustc.__spliced (because they're not inside a derivation, read through the issue.)
nix-repl> pkgsCross.aarch64-multiplatform.python3Packages.cryptography.nativeBuildInputs
[ ... «derivation /nix/store/7zsx9k68akrnhbznhr2q63fcxv853ksv-cargo-setup-hook.sh.drv» «derivation /nix/store/31rhagc1nqf5d0wdjwvc0hbg3dg71xcl-python3.10-setuptools-rust-1.5.2.drv» «derivation /nix/store/1977acij72524vy0c8ij19ng7nzrf6yv-cargo-1.68.2.drv» «derivation /nix/store/b0lpygng67j4iww09wr9c45gl66vs84d-rustc-1.68.2.drv» ]
no aarch64-unknown-linux-gnu suffix so they should be for build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff --git a/pkgs/development/python-modules/cryptography/default.nix b/pkgs/development/python-modules/cryptography/default.nix
index ba2407923f3..105a5dd4dfc 100644
--- a/pkgs/development/python-modules/cryptography/default.nix
+++ b/pkgs/development/python-modules/cryptography/default.nix
@@ -77,6 +77,8 @@ buildPythonPackage rec {
"--disable-pytest-warnings"
];
+ passthru = { inherit rustPlatform; };
+
disabledTestPaths = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
# aarch64-darwin forbids W+X memory, but this tests depends on it:
# * https://cffi.readthedocs.io/en/latest/using.html#callbacks
nix-repl> pkgsCross.aarch64-multiplatform.__splicedPackages.python3Packages.cryptography.rustPlatform.rust.rustc.__spliced
{ buildBuild = «derivation /nix/store/b0lpygng67j4iww09wr9c45gl66vs84d-rustc-1.68.2.drv»; buildHost = «derivation /nix/store/b0lpygng67j4iww09wr9c45gl66vs84d-rustc-1.68.2.drv»; buildTarget = «derivation /nix/store/b0lpygng67j4iww09wr9c45gl66vs84d-rustc-1.68.2.drv»; hostHost = «derivation /nix/store/g01vq22qlqgpcihqjvg2g79byg04gplv-rustc-1.68.2.drv»; hostTarget = «derivation /nix/store/g01vq22qlqgpcihqjvg2g79byg04gplv-rustc-1.68.2.drv»; }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be similar to #211340 but it's not the issue here because those attrs are spliced correctly ... (because they're not inside a derivation, read through the issue.)
In other words, it is exactly the issue here, but "spliced correctly" has been defined in a way that is totally contrary to peoples' expectations about how this should work, just so this can be declared NOTABUG
.
I think it is time to admit that the splicing magic was not a good idea. It misleads people into thinking they know what's going on when they don't.
Your Edit: sorry, I misinterpreted that diff as being a proposed solution rather than an investigatory tool.passthru
hack is the same kind of thing: sure, it works, but for reasons that 99% of the people reading the code will not understand. It is a footgun.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your passthru hack is the same kind of thing: sure, it works, but for reasons that 99% of the people reading the code will not understand. It is a footgun.
It's not a hack, it's just for inspecting the attrset and showing that the package attrs have __spliced.
I think this will be fixed on a higher level and for all packages in #212795 and also for cryptography. I think the linked PR is the more correct solution for your problem, hence I am going to close this one. We would appreciate it, if you could test #212795 and give us feedback, if it fixes your problem. |
This PR was produced by banging my head against the wall. Repeatedly.
Description of changes
Make
pkgsCross.*.python-cryptography
build.setuptools-rust and rustPlatform.cargoSetupHook has been moved from nativeBuildInputs to buildInputs.
rustPlatform seems to interfere with splicing, so rustc and cargo are now top-level parameters in order to facilitate that.
Two environment variables need to be passed explicitly:
CARGO_BUILD_TARGET because otherwise the final link step attempts to use the hostPlatform linker
PYO3_CROSS_LIB_DIR because without it pyo3 throws a fit.
Things done
x86_64-linux
)