about summary refs log tree commit diff
path: root/pkgs/shells
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2022-05-31 18:32:53 +0300
committerGitHub <noreply@github.com>2022-05-31 18:32:53 +0300
commit2e6d39ac826d9b1ec2525266e7e4932ae41be3c6 (patch)
tree1443f5f6b4661fc43342a5bd3530c1abdac6bf03 /pkgs/shells
parent945fcc987f73982aefd4b63047d0a36a400f3017 (diff)
parent7d735f01a4046fed90a2d14ecfceeb40fc18b88c (diff)
Merge pull request #175178 from Artturin/rustthing1
nushell: use cargo-edit instead of a patch to add pkg-config feature 
Diffstat (limited to 'pkgs/shells')
-rw-r--r--pkgs/shells/nushell/default.nix32
-rw-r--r--pkgs/shells/nushell/use-system-zstd-lib.diff32
2 files changed, 18 insertions, 46 deletions
diff --git a/pkgs/shells/nushell/default.nix b/pkgs/shells/nushell/default.nix
index b096301f0e63c..7c3c586ae1294 100644
--- a/pkgs/shells/nushell/default.nix
+++ b/pkgs/shells/nushell/default.nix
@@ -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
diff --git a/pkgs/shells/nushell/use-system-zstd-lib.diff b/pkgs/shells/nushell/use-system-zstd-lib.diff
deleted file mode 100644
index 6b0831cd9fbc5..0000000000000
--- a/pkgs/shells/nushell/use-system-zstd-lib.diff
+++ /dev/null
@@ -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"