From b9259df616359f2badec2ab315c88989eacc0ac5 Mon Sep 17 00:00:00 2001 From: figsoda Date: Thu, 12 Jan 2023 12:22:07 -0500 Subject: [PATCH] rustPlatform.buildRustPackage: fix cross compiling auditable packages --- pkgs/build-support/rust/build-rust-package/default.nix | 3 ++- .../rust/cargo-auditable-cargo-wrapper.nix} | 0 .../default.nix => compilers/rust/cargo-auditable.nix} | 0 pkgs/development/compilers/rust/default.nix | 2 ++ pkgs/development/compilers/rust/make-rust-platform.nix | 9 +++++++-- pkgs/top-level/all-packages.nix | 4 +--- 6 files changed, 12 insertions(+), 6 deletions(-) rename pkgs/development/{tools/rust/cargo-auditable/cargo-wrapper.nix => compilers/rust/cargo-auditable-cargo-wrapper.nix} (100%) rename pkgs/development/{tools/rust/cargo-auditable/default.nix => compilers/rust/cargo-auditable.nix} (100%) diff --git a/pkgs/build-support/rust/build-rust-package/default.nix b/pkgs/build-support/rust/build-rust-package/default.nix index a24425bf27aa..69ee4f56b98f 100644 --- a/pkgs/build-support/rust/build-rust-package/default.nix +++ b/pkgs/build-support/rust/build-rust-package/default.nix @@ -10,6 +10,7 @@ , cargoInstallHook , cargoNextestHook , cargoSetupHook +, cargo , cargo-auditable , cargo-auditable-cargo-wrapper , rustc @@ -120,7 +121,7 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg nativeBuildInputs = nativeBuildInputs ++ lib.optionals auditable [ (cargo-auditable-cargo-wrapper.override { - inherit cargo-auditable; + inherit cargo cargo-auditable; }) ] ++ [ cacert diff --git a/pkgs/development/tools/rust/cargo-auditable/cargo-wrapper.nix b/pkgs/development/compilers/rust/cargo-auditable-cargo-wrapper.nix similarity index 100% rename from pkgs/development/tools/rust/cargo-auditable/cargo-wrapper.nix rename to pkgs/development/compilers/rust/cargo-auditable-cargo-wrapper.nix diff --git a/pkgs/development/tools/rust/cargo-auditable/default.nix b/pkgs/development/compilers/rust/cargo-auditable.nix similarity index 100% rename from pkgs/development/tools/rust/cargo-auditable/default.nix rename to pkgs/development/compilers/rust/cargo-auditable.nix diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix index 7a100f7ec911..42ca74c7164d 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -81,6 +81,8 @@ in rustPlatform = bootRustPlatform; inherit CoreFoundation Security; }; + cargo-auditable = self.callPackage ./cargo-auditable.nix { }; + cargo-auditable-cargo-wrapper = self.callPackage ./cargo-auditable-cargo-wrapper.nix { }; clippy = self.callPackage ./clippy.nix { inherit Security; }; }); }; diff --git a/pkgs/development/compilers/rust/make-rust-platform.nix b/pkgs/development/compilers/rust/make-rust-platform.nix index fcfd02dcf6cd..25a692565db3 100644 --- a/pkgs/development/compilers/rust/make-rust-platform.nix +++ b/pkgs/development/compilers/rust/make-rust-platform.nix @@ -1,6 +1,11 @@ { buildPackages, callPackage, stdenv, runCommand }@prev: -{ rustc, cargo, stdenv ? prev.stdenv, ... }: +{ rustc +, cargo +, cargo-auditable ? null +, stdenv ? prev.stdenv +, ... +}: rec { rust = { @@ -14,7 +19,7 @@ rec { buildRustPackage = callPackage ../../../build-support/rust/build-rust-package { inherit stdenv cargoBuildHook cargoCheckHook cargoInstallHook cargoNextestHook cargoSetupHook - fetchCargoTarball importCargoLock rustc; + fetchCargoTarball importCargoLock rustc cargo cargo-auditable; }; importCargoLock = buildPackages.callPackage ../../../build-support/rust/import-cargo-lock.nix { inherit cargo; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 133ff0345018..ef7c41a72ae8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15419,7 +15419,7 @@ with pkgs; rustPackages_1_66 = rust_1_66.packages.stable; rustPackages = rustPackages_1_66; - inherit (rustPackages) cargo clippy rustc rustPlatform; + inherit (rustPackages) cargo cargo-auditable cargo-auditable-cargo-wrapper clippy rustc rustPlatform; makeRustPlatform = callPackage ../development/compilers/rust/make-rust-platform.nix {}; @@ -15449,8 +15449,6 @@ with pkgs; cargo-audit = callPackage ../development/tools/rust/cargo-audit { inherit (darwin.apple_sdk.frameworks) Security; }; - cargo-auditable = callPackage ../development/tools/rust/cargo-auditable { }; - cargo-auditable-cargo-wrapper = callPackage ../development/tools/rust/cargo-auditable/cargo-wrapper.nix { }; cargo-bisect-rustc = callPackage ../development/tools/rust/cargo-bisect-rustc { inherit (darwin.apple_sdk.frameworks) Security; openssl = openssl_1_1;