···99 postFixup = "wrapPythonPrograms";
1010 doInstallCheck = true;
1111 installCheckPhase = ''
1212- # check that ./fetchcargo-default-config.toml is a fix point
1313- reference=${./fetchcargo-default-config.toml}
1212+ # check that ../fetchcargo-default-config.toml is a fix point
1313+ reference=${../fetchcargo-default-config.toml}
1414 < $reference $out/bin/cargo-vendor-normalise > test;
1515 cmp test $reference
1616 '';
+37
pkgs/build-support/rust/lib/default.nix
···11+{ lib }:
22+33+rec {
44+ # https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch
55+ toTargetArch = platform:
66+ if platform.isAarch32 then "arm"
77+ else platform.parsed.cpu.name;
88+99+ # https://doc.rust-lang.org/reference/conditional-compilation.html#target_os
1010+ toTargetOs = platform:
1111+ if platform.isDarwin then "macos"
1212+ else platform.parsed.kernel.name;
1313+1414+ # Returns the name of the rust target, even if it is custom. Adjustments are
1515+ # because rust has slightly different naming conventions than we do.
1616+ toRustTarget = platform: let
1717+ inherit (platform.parsed) cpu vendor kernel abi;
1818+ cpu_ = platform.rustc.platform.arch or {
1919+ "armv7a" = "armv7";
2020+ "armv7l" = "armv7";
2121+ "armv6l" = "arm";
2222+ "armv5tel" = "armv5te";
2323+ "riscv64" = "riscv64gc";
2424+ }.${cpu.name} or cpu.name;
2525+ vendor_ = platform.rustc.platform.vendor or {
2626+ "w64" = "pc";
2727+ }.${vendor.name} or vendor.name;
2828+ in platform.rustc.config
2929+ or "${cpu_}-${vendor_}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}";
3030+3131+ # Returns the name of the rust target if it is standard, or the json file
3232+ # containing the custom target spec.
3333+ toRustTargetSpec = platform:
3434+ if (platform.rustc or {}) ? platform
3535+ then builtins.toFile (toRustTarget platform + ".json") (builtins.toJSON platform.rustc.platform)
3636+ else toRustTarget platform;
3737+}
···1818, CoreFoundation, Security, SystemConfiguration
1919, pkgsBuildTarget, pkgsBuildBuild
2020, makeRustPlatform
2121-}: rec {
2222- # https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch
2323- toTargetArch = platform:
2424- if platform.isAarch32 then "arm"
2525- else platform.parsed.cpu.name;
2626-2727- # https://doc.rust-lang.org/reference/conditional-compilation.html#target_os
2828- toTargetOs = platform:
2929- if platform.isDarwin then "macos"
3030- else platform.parsed.kernel.name;
2121+}:
31223232- # Returns the name of the rust target, even if it is custom. Adjustments are
3333- # because rust has slightly different naming conventions than we do.
3434- toRustTarget = platform: with platform.parsed; let
3535- cpu_ = platform.rustc.platform.arch or {
3636- "armv7a" = "armv7";
3737- "armv7l" = "armv7";
3838- "armv6l" = "arm";
3939- "armv5tel" = "armv5te";
4040- "riscv64" = "riscv64gc";
4141- }.${cpu.name} or cpu.name;
4242- vendor_ = platform.rustc.platform.vendor or {
4343- "w64" = "pc";
4444- }.${vendor.name} or vendor.name;
4545- in platform.rustc.config
4646- or "${cpu_}-${vendor_}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}";
2323+let
2424+ # Use `import` to make sure no packages sneak in here.
2525+ lib' = import ../../../build-support/rust/lib { inherit lib; };
2626+in
2727+{
2828+ lib = lib';
47294848- # Returns the name of the rust target if it is standard, or the json file
4949- # containing the custom target spec.
5050- toRustTargetSpec = platform:
5151- if (platform.rustc or {}) ? platform
5252- then builtins.toFile (toRustTarget platform + ".json") (builtins.toJSON platform.rustc.platform)
5353- else toRustTarget platform;
3030+ # Backwards compat before `lib` was factored out.
3131+ inherit (lib') toTargetArch toTargetOs toRustTarget toRustTargetSpec;
54325533 # This just contains tools for now. But it would conceivably contain
5634 # libraries too, say if we picked some default/recommended versions from