about summary refs log tree commit diff
path: root/pkgs/development/interpreters/python/hooks
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-05-09 13:38:32 +0000
committerAlyssa Ross <hi@alyssa.is>2023-11-09 10:02:24 +0100
commite3e57b8f1885bf1dc4787728479711f46a4171cc (patch)
treee83bec78d2ee16e3453cfb39b45c03f759cb06c8 /pkgs/development/interpreters/python/hooks
parentfecd99b105c644b1b61abfec6c203b304269e1e2 (diff)
downloadnixlib-e3e57b8f1885bf1dc4787728479711f46a4171cc.tar
nixlib-e3e57b8f1885bf1dc4787728479711f46a4171cc.tar.gz
nixlib-e3e57b8f1885bf1dc4787728479711f46a4171cc.tar.bz2
nixlib-e3e57b8f1885bf1dc4787728479711f46a4171cc.tar.lz
nixlib-e3e57b8f1885bf1dc4787728479711f46a4171cc.tar.xz
nixlib-e3e57b8f1885bf1dc4787728479711f46a4171cc.tar.zst
nixlib-e3e57b8f1885bf1dc4787728479711f46a4171cc.zip
lib.systems: elaborate Rust metadata
We need this stuff to be available in lib so make-derivation.nix can
access it to construct the Meson cross file.

This has a couple of other advantages:

 - It makes Rust less special.  Now figuring out what Rust calls a
   platform is the same as figuring out what Linux or QEMU call it.

 - We can unify the schema used to define Rust targets, and the schema
   used to access those values later.  Just like you can set "config"
   or "system" in a platform definition, and then access those same
   keys on the elaborated platform, you can now set "rustcTarget" in
   your crossSystem, and then access "stdenv.hostPlatform.rustcTarget"
   in your code.

"rustcTarget", "rustcTargetSpec", "cargoShortTarget", and
"cargoEnvVarTarget" have the "rustc" and "cargo" prefixes because
these are not exposed to code by the compiler, and are not
standardized.  The arch/os/etc. variables are all named to match the
forms in the Rust target spec JSON.

The new rust.target-family only takes a list, since we don't need to
worry about backwards compatibility when that name is used.

The old APIs are all still functional with no warning for now, so that
it's possible for external code to use a single API on both 23.05 and
23.11.  We can introduce the warnings once 23.05 is EOL, and make them
hard errors when 23.11 is EOL.
Diffstat (limited to 'pkgs/development/interpreters/python/hooks')
-rw-r--r--pkgs/development/interpreters/python/hooks/default.nix8
1 files changed, 3 insertions, 5 deletions
diff --git a/pkgs/development/interpreters/python/hooks/default.nix b/pkgs/development/interpreters/python/hooks/default.nix
index a907cda5f117..f7cc10274ae3 100644
--- a/pkgs/development/interpreters/python/hooks/default.nix
+++ b/pkgs/development/interpreters/python/hooks/default.nix
@@ -183,16 +183,14 @@ in {
       };
     } ./setuptools-check-hook.sh) {};
 
-    setuptoolsRustBuildHook = callPackage ({ makePythonHook, setuptools-rust, rust }:
+    setuptoolsRustBuildHook = callPackage ({ makePythonHook, setuptools-rust }:
       makePythonHook {
         name = "setuptools-rust-setup-hook";
         propagatedBuildInputs = [ setuptools-rust ];
         substitutions = {
           pyLibDir = "${python}/lib/${python.libPrefix}";
-          cargoBuildTarget = rust.toRustTargetSpec stdenv.hostPlatform;
-          cargoLinkerVar = lib.toUpper (
-              builtins.replaceStrings ["-"] ["_"] (
-                rust.toRustTarget stdenv.hostPlatform));
+          cargoBuildTarget = stdenv.hostPlatform.rust.rustcTargetSpec;
+          cargoLinkerVar = stdenv.hostPlatform.rust.cargoEnvVarTarget;
           targetLinker = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
         };
       } ./setuptools-rust-hook.sh) {};