Merge pull request #274440 from bouk/missing-build-rust-env
build-rust-crate: add missing CARGO_PKG env variables
This commit is contained in:
commit
ec84d47ff6
2 changed files with 22 additions and 4 deletions
|
@ -7,12 +7,17 @@
|
||||||
, completeBuildDeps
|
, completeBuildDeps
|
||||||
, completeDeps
|
, completeDeps
|
||||||
, crateAuthors
|
, crateAuthors
|
||||||
, crateLinks
|
|
||||||
, crateDescription
|
, crateDescription
|
||||||
, crateHomepage
|
|
||||||
, crateFeatures
|
, crateFeatures
|
||||||
|
, crateHomepage
|
||||||
|
, crateLicense
|
||||||
|
, crateLicenseFile
|
||||||
|
, crateLinks
|
||||||
, crateName
|
, crateName
|
||||||
|
, crateReadme
|
||||||
, crateRenames
|
, crateRenames
|
||||||
|
, crateRepository
|
||||||
|
, crateRustVersion
|
||||||
, crateVersion
|
, crateVersion
|
||||||
, extraLinkFlags
|
, extraLinkFlags
|
||||||
, extraRustcOptsForBuildRs
|
, extraRustcOptsForBuildRs
|
||||||
|
@ -120,6 +125,8 @@ in ''
|
||||||
|
|
||||||
EXTRA_BUILD=""
|
EXTRA_BUILD=""
|
||||||
BUILD_OUT_DIR=""
|
BUILD_OUT_DIR=""
|
||||||
|
|
||||||
|
# Set up Cargo Environment variables: https://doc.rust-lang.org/cargo/reference/environment-variables.html
|
||||||
export CARGO_PKG_NAME=${crateName}
|
export CARGO_PKG_NAME=${crateName}
|
||||||
export CARGO_PKG_VERSION=${crateVersion}
|
export CARGO_PKG_VERSION=${crateVersion}
|
||||||
export CARGO_PKG_AUTHORS="${authors}"
|
export CARGO_PKG_AUTHORS="${authors}"
|
||||||
|
@ -147,6 +154,11 @@ in ''
|
||||||
export CARGO_PKG_VERSION_PATCH=${lib.elemAt version 2}
|
export CARGO_PKG_VERSION_PATCH=${lib.elemAt version 2}
|
||||||
export CARGO_PKG_VERSION_PRE="${versionPre}"
|
export CARGO_PKG_VERSION_PRE="${versionPre}"
|
||||||
export CARGO_PKG_HOMEPAGE="${crateHomepage}"
|
export CARGO_PKG_HOMEPAGE="${crateHomepage}"
|
||||||
|
export CARGO_PKG_LICENSE="${crateLicense}"
|
||||||
|
export CARGO_PKG_LICENSE_FILE="${crateLicenseFile}"
|
||||||
|
export CARGO_PKG_README="${crateReadme}"
|
||||||
|
export CARGO_PKG_REPOSITORY="${crateRepository}"
|
||||||
|
export CARGO_PKG_RUST_VERSION="${crateRustVersion}"
|
||||||
export NUM_JOBS=$NIX_BUILD_CORES
|
export NUM_JOBS=$NIX_BUILD_CORES
|
||||||
export RUSTC="rustc"
|
export RUSTC="rustc"
|
||||||
export RUSTDOC="rustdoc"
|
export RUSTDOC="rustdoc"
|
||||||
|
|
|
@ -314,11 +314,16 @@ crate_: lib.makeOverridable
|
||||||
# Either set to a concrete sub path to the crate root
|
# Either set to a concrete sub path to the crate root
|
||||||
# or use `null` for auto-detect.
|
# or use `null` for auto-detect.
|
||||||
workspace_member = crate.workspace_member or ".";
|
workspace_member = crate.workspace_member or ".";
|
||||||
crateVersion = crate.version;
|
|
||||||
crateDescription = crate.description or "";
|
|
||||||
crateAuthors = if crate ? authors && lib.isList crate.authors then crate.authors else [ ];
|
crateAuthors = if crate ? authors && lib.isList crate.authors then crate.authors else [ ];
|
||||||
|
crateDescription = crate.description or "";
|
||||||
crateHomepage = crate.homepage or "";
|
crateHomepage = crate.homepage or "";
|
||||||
|
crateLicense = crate.license or "";
|
||||||
|
crateLicenseFile = crate.license-file or "";
|
||||||
crateLinks = crate.links or "";
|
crateLinks = crate.links or "";
|
||||||
|
crateReadme = crate.readme or "";
|
||||||
|
crateRepository = crate.repository or "";
|
||||||
|
crateRustVersion = crate.rust-version or "";
|
||||||
|
crateVersion = crate.version;
|
||||||
crateType =
|
crateType =
|
||||||
if lib.attrByPath [ "procMacro" ] false crate then [ "proc-macro" ] else
|
if lib.attrByPath [ "procMacro" ] false crate then [ "proc-macro" ] else
|
||||||
if lib.attrByPath [ "plugin" ] false crate then [ "dylib" ] else
|
if lib.attrByPath [ "plugin" ] false crate then [ "dylib" ] else
|
||||||
|
@ -341,6 +346,7 @@ crate_: lib.makeOverridable
|
||||||
inherit crateName buildDependencies completeDeps completeBuildDeps crateDescription
|
inherit crateName buildDependencies completeDeps completeBuildDeps crateDescription
|
||||||
crateFeatures crateRenames libName build workspace_member release libPath crateVersion crateLinks
|
crateFeatures crateRenames libName build workspace_member release libPath crateVersion crateLinks
|
||||||
extraLinkFlags extraRustcOptsForBuildRs
|
extraLinkFlags extraRustcOptsForBuildRs
|
||||||
|
crateLicense crateLicenseFile crateReadme crateRepository crateRustVersion
|
||||||
crateAuthors crateHomepage verbose colors codegenUnits;
|
crateAuthors crateHomepage verbose colors codegenUnits;
|
||||||
};
|
};
|
||||||
buildPhase = buildCrate {
|
buildPhase = buildCrate {
|
||||||
|
|
Loading…
Reference in a new issue