From 8ffe19c0996b6f077459637edfb3c3731709112a Mon Sep 17 00:00:00 2001 From: Luka Blaskovic Date: Sat, 11 Nov 2023 06:15:23 +0000 Subject: [PATCH] build-rust-crate: set CARGO_MANIFEST_LINKS if links is set --- pkgs/build-support/rust/build-rust-crate/configure-crate.nix | 2 ++ pkgs/build-support/rust/build-rust-crate/default.nix | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix index 60310f178747..29447aa751a9 100644 --- a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix +++ b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix @@ -7,6 +7,7 @@ , completeBuildDeps , completeDeps , crateAuthors +, crateLinks , crateDescription , crateHomepage , crateFeatures @@ -134,6 +135,7 @@ in '' export CARGO_CFG_TARGET_VENDOR=${stdenv.hostPlatform.parsed.vendor.name} export CARGO_MANIFEST_DIR=$(pwd) + export CARGO_MANIFEST_LINKS=${crateLinks} export DEBUG="${toString (!release)}" export OPT_LEVEL="${toString optLevel}" export TARGET="${rust.toRustTargetSpec stdenv.hostPlatform}" diff --git a/pkgs/build-support/rust/build-rust-crate/default.nix b/pkgs/build-support/rust/build-rust-crate/default.nix index d977fb9f7c27..672a96226634 100644 --- a/pkgs/build-support/rust/build-rust-crate/default.nix +++ b/pkgs/build-support/rust/build-rust-crate/default.nix @@ -240,6 +240,7 @@ crate_: lib.makeOverridable "edition" "buildTests" "codegenUnits" + "links" ]; extraDerivationAttrs = builtins.removeAttrs crate processedAttrs; nativeBuildInputs_ = nativeBuildInputs; @@ -322,6 +323,7 @@ crate_: lib.makeOverridable crateDescription = crate.description or ""; crateAuthors = if crate ? authors && lib.isList crate.authors then crate.authors else [ ]; crateHomepage = crate.homepage or ""; + crateLinks = crate.links or ""; crateType = if lib.attrByPath [ "procMacro" ] false crate then [ "proc-macro" ] else if lib.attrByPath [ "plugin" ] false crate then [ "dylib" ] else @@ -342,7 +344,7 @@ crate_: lib.makeOverridable configurePhase = configureCrate { inherit crateName buildDependencies completeDeps completeBuildDeps crateDescription - crateFeatures crateRenames libName build workspace_member release libPath crateVersion + crateFeatures crateRenames libName build workspace_member release libPath crateVersion crateLinks extraLinkFlags extraRustcOptsForBuildRs crateAuthors crateHomepage verbose colors codegenUnits; };