diff --git a/pkgs/shells/nushell/default.nix b/pkgs/shells/nushell/default.nix index 1f510a65a302..7ef45040d12d 100644 --- a/pkgs/shells/nushell/default.nix +++ b/pkgs/shells/nushell/default.nix @@ -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 ] diff --git a/pkgs/shells/nushell/zstd-pkg-config.patch b/pkgs/shells/nushell/zstd-pkg-config.patch new file mode 100644 index 000000000000..762f1f3f0bcb --- /dev/null +++ b/pkgs/shells/nushell/zstd-pkg-config.patch @@ -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"