Merge pull request #175178 from Artturin/rustthing1
nushell: use cargo-edit instead of a patch to add pkg-config feature
This commit is contained in:
commit
2e6d39ac82
4 changed files with 22 additions and 49 deletions
|
@ -97,7 +97,7 @@ in
|
|||
# See https://os.phil-opp.com/testing/ for more information.
|
||||
assert useSysroot -> !(args.doCheck or true);
|
||||
|
||||
stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoLock" ]) // lib.optionalAttrs useSysroot {
|
||||
stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "cargoLock" ]) // lib.optionalAttrs useSysroot {
|
||||
RUSTFLAGS = "--sysroot ${sysroot} " + (args.RUSTFLAGS or "");
|
||||
} // {
|
||||
inherit buildAndTestSubdir cargoDeps;
|
||||
|
|
|
@ -23,6 +23,7 @@ in
|
|||
, patches ? []
|
||||
, sourceRoot ? ""
|
||||
, cargoUpdateHook ? ""
|
||||
, nativeBuildInputs ? []
|
||||
, ...
|
||||
} @ args:
|
||||
|
||||
|
@ -32,7 +33,7 @@ let hash_ =
|
|||
else throw "fetchCargoTarball requires a hash for ${name}";
|
||||
in stdenv.mkDerivation ({
|
||||
name = "${name}-vendor.tar.gz";
|
||||
nativeBuildInputs = [ cacert git cargo-vendor-normalise cargo ];
|
||||
nativeBuildInputs = [ cacert git cargo-vendor-normalise cargo ] ++ nativeBuildInputs;
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
@ -82,5 +83,5 @@ in stdenv.mkDerivation ({
|
|||
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
|
||||
} // (builtins.removeAttrs args [
|
||||
"name" "sha256" "cargoUpdateHook"
|
||||
"name" "sha256" "cargoUpdateHook" "nativeBuildInputs"
|
||||
]))
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
, Security
|
||||
, nghttp2
|
||||
, libgit2
|
||||
, cargo-edit
|
||||
, withExtraFeatures ? true
|
||||
, testers
|
||||
, nushell
|
||||
|
@ -29,7 +30,23 @@ rustPlatform.buildRustPackage rec {
|
|||
sha256 = "sha256-4thvUSOSvH/bv0aW7hGGQMvtXdS+yDfZzPRLZmPZQMQ=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-ALUp6sPcmnJy/A078umyKg8KBv23P0vv8mwoO9OU+DQ=";
|
||||
cargoSha256 = "sha256-Vd8R9EsO52q840HqRzc37PirZZyTZr+Bnow5qHEacJ0=";
|
||||
# Since 0.34, nu has an indirect dependency on `zstd-sys` (via `polars` and
|
||||
# `parquet`, for dataframe support), which by default has an impure build
|
||||
# (git submodule for the `zstd` C library). The `pkg-config` feature flag
|
||||
# fixes this, but it's hard to invoke this in the right place, because of
|
||||
# the indirect dependencies. So add a direct dependency on `zstd-sys` here
|
||||
# at the top level, along with this feature flag, to ensure that when
|
||||
# `zstd-sys` is transitively invoked, it triggers a pure build using the
|
||||
# system `zstd` library provided above.
|
||||
depsExtraArgs = { nativeBuildInputs = [ cargo-edit ]; };
|
||||
# cargo add has been merged in to cargo so the above can be removed once 1.62.0 is available in nixpkgs
|
||||
# https://github.com/rust-lang/cargo/pull/10472
|
||||
cargoUpdateHook = ''
|
||||
cargo add zstd-sys --features pkg-config --offline
|
||||
# write the change to the lockfile
|
||||
cargo update --package zstd-sys --offline
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ pkg-config ]
|
||||
++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ python3 ];
|
||||
|
@ -41,19 +58,6 @@ rustPlatform.buildRustPackage rec {
|
|||
|
||||
buildFeatures = lib.optional withExtraFeatures "extra";
|
||||
|
||||
# Since 0.34, nu has an indirect dependency on `zstd-sys` (via `polars` and
|
||||
# `parquet`, for dataframe support), which by default has an impure build
|
||||
# (git submodule for the `zstd` C library). The `pkg-config` feature flag
|
||||
# fixes this, but it's hard to invoke this in the right place, because of
|
||||
# the indirect dependencies. So add a direct dependency on `zstd-sys` here
|
||||
# at the top level, along with this feature flag, to ensure that when
|
||||
# `zstd-sys` is transitively invoked, it triggers a pure build using the
|
||||
# system `zstd` library provided above.
|
||||
#
|
||||
# (If this patch needs updating, in a nushell repo add the zstd-sys line to
|
||||
# Cargo.toml, then `cargo update --package zstd-sys` to update Cargo.lock.)
|
||||
cargoPatches = [ ./use-system-zstd-lib.diff ];
|
||||
|
||||
# TODO investigate why tests are broken on darwin
|
||||
# failures show that tests try to write to paths
|
||||
# outside of TMPDIR
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
diff --git a/Cargo.lock b/Cargo.lock
|
||||
index 6cebf66d..b6e40cd9 100644
|
||||
--- a/Cargo.lock
|
||||
+++ b/Cargo.lock
|
||||
@@ -2443,6 +2443,7 @@ dependencies = [
|
||||
"rstest",
|
||||
"serial_test",
|
||||
"tempfile",
|
||||
+ "zstd-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5365,4 +5366,5 @@ checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
+ "pkg-config",
|
||||
]
|
||||
diff --git a/Cargo.toml b/Cargo.toml
|
||||
index 0791d462..d520d9ae 100644
|
||||
--- a/Cargo.toml
|
||||
+++ b/Cargo.toml
|
||||
@@ -58,6 +58,9 @@ rayon = "1.5.1"
|
||||
reedline = { version = "0.6.0", features = ["bashisms"]}
|
||||
is_executable = "1.0.1"
|
||||
|
||||
+# Specify that the indirect dependency ztsd-sys should pick up the system zstd C library
|
||||
+zstd-sys = { version = "2", features = [ "pkg-config" ] }
|
||||
+
|
||||
[dev-dependencies]
|
||||
nu-test-support = { path="./crates/nu-test-support", version = "0.63.0" }
|
||||
tempfile = "3.2.0"
|
Loading…
Reference in a new issue