nushell: patch Cargo to use pkgconfig for zstd

Reverts the meaningful change in 5f3b928696e7c03f03d3cf2fe970e4bca47367ee.

https://github.com/NixOS/nixpkgs/pull/183712#discussion_r934027513

See also: cargo-about, cargo-deny

Co-authored-by: Florian Warzecha <liketechnik@disroot.org>
This commit is contained in:
Shane Sveller 2022-07-31 14:15:54 -05:00
parent 5f3c07633a
commit 0d117eb087
No known key found for this signature in database
GPG Key ID: 50D400D246CD0F3E
2 changed files with 35 additions and 18 deletions

View File

@ -13,7 +13,6 @@
, Security
, nghttp2
, libgit2
, cargo-edit
, withExtraFeatures ? true
, testers
, nushell
@ -30,23 +29,10 @@ rustPlatform.buildRustPackage rec {
sha256 = "sha256-PaPj2hbObY4wXubN3Mvr0TlpI13Zgkey90qAgpB0qOo=";
};
cargoSha256 = "sha256-4gYafGaQu+UWMQoQ9bf8Cm5rKZhO5ZbKDOitC4HXNdI=";
# 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
'';
cargoSha256 = "sha256-KRkPVemgK7RDWJi4TqHNqZLwpwUkx+K15u52Do+pqik=";
# enable pkg-config feature of zstd
cargoPatches = [ ./zstd-pkg-config.patch ];
nativeBuildInputs = [ pkg-config ]
++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ python3 ]

View File

@ -0,0 +1,31 @@
diff --git a/Cargo.lock b/Cargo.lock
index d4c2ebe3a..bc78478c3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2641,6 +2641,7 @@ dependencies = [
"wax",
"which",
"windows",
+ "zstd",
]
[[package]]
@@ -5604,4 +5605,5 @@ checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b"
dependencies = [
"cc",
"libc",
+ "pkg-config",
]
diff --git a/crates/nu-command/Cargo.toml b/crates/nu-command/Cargo.toml
index 8a9d29562..374ffa153 100644
--- a/crates/nu-command/Cargo.toml
+++ b/crates/nu-command/Cargo.toml
@@ -89,6 +89,8 @@ wax = { version = "0.5.0", features = ["diagnostics"] }
rusqlite = { version = "0.28.0", features = ["bundled"], optional = true }
sqlparser = { version = "0.16.0", features = ["serde"], optional = true }
+zstd = { version = "*", features = [ "pkg-config" ] }
+
[target.'cfg(unix)'.dependencies]
umask = "2.0.0"
users = "0.11.0"