about summary refs log tree commit diff
path: root/pkgs/shells
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2022-09-08 05:36:47 -0500
committerGitHub <noreply@github.com>2022-09-08 05:36:47 -0500
commit4b9e3d1276e863f38557cc4551d9a2fe274afca3 (patch)
tree86e0ac0d8f080bf8d9ee3527169b89b1b31330d2 /pkgs/shells
parent2b3aedb4b2c05105609268f1997b37d3b030af74 (diff)
parent5d34561c4ada684fe511283e920cc366ff7d9965 (diff)
Merge pull request #183712 from shanesveller/package-nushell-0.66.2
nushell: 0.65.0 -> 0.67.0
Diffstat (limited to 'pkgs/shells')
-rw-r--r--pkgs/shells/nushell/default.nix49
-rw-r--r--pkgs/shells/nushell/zstd-pkg-config.patch31
2 files changed, 58 insertions, 22 deletions
diff --git a/pkgs/shells/nushell/default.nix b/pkgs/shells/nushell/default.nix
index 08445c4176a4a..0a4070d50db41 100644
--- a/pkgs/shells/nushell/default.nix
+++ b/pkgs/shells/nushell/default.nix
@@ -1,6 +1,7 @@
 { stdenv
 , lib
 , fetchFromGitHub
+, runCommand
 , rustPlatform
 , openssl
 , zlib
@@ -10,10 +11,12 @@
 , xorg
 , libiconv
 , AppKit
+, Foundation
 , Security
+# darwin.apple_sdk.sdk
+, sdk
 , nghttp2
 , libgit2
-, cargo-edit
 , withExtraFeatures ? true
 , testers
 , nushell
@@ -21,39 +24,41 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "nushell";
-  version = "0.65.0";
+  version = "0.67.0";
 
   src = fetchFromGitHub {
     owner = pname;
     repo = pname;
     rev = version;
-    sha256 = "sha256-KgXhmAOJaAvmNuDqSaW+h6GF5rWYgj8/wn+vz9V9S7M=";
+    sha256 = "sha256-O5uM27DvcpwlZStFFLYRDRtFXzAzUdG7v0phK9LJsSo=";
   };
 
-  cargoSha256 = "sha256-YqtM/1p6oP0+E0rYSFPeCbof06E81eC2PZIwkU7J0I4=";
-  # 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-eGUI+/Vmqv+BCIQCGoF4Egf3oNyonM3tpt1R3EjIocQ=";
+
+  # enable pkg-config feature of zstd
+  cargoPatches = [ ./zstd-pkg-config.patch ];
 
   nativeBuildInputs = [ pkg-config ]
-    ++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ python3 ];
+    ++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ python3 ]
+    ++ lib.optionals stdenv.isDarwin [ rustPlatform.bindgenHook ];
 
   buildInputs = [ openssl zstd ]
     ++ lib.optionals stdenv.isDarwin [ zlib libiconv Security ]
-    ++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ xorg.libX11 ]
+    ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
+    Foundation
+    (
+      # Pull a header that contains a definition of proc_pid_rusage().
+      # (We pick just that one because using the other headers from `sdk` is not
+      # compatible with our C++ standard library. This header is already in
+      # the standard library on aarch64)
+      # See also:
+      # https://github.com/shanesveller/nixpkgs/tree/90ed23b1b23c8ee67928937bdec7ddcd1a0050f5/pkgs/development/libraries/webkitgtk/default.nix
+      # https://github.com/shanesveller/nixpkgs/blob/90ed23b1b23c8ee67928937bdec7ddcd1a0050f5/pkgs/tools/system/btop/default.nix#L32-L38
+      runCommand "${pname}_headers" { } ''
+        install -Dm444 "${lib.getDev sdk}"/include/libproc.h "$out"/include/libproc.h
+      ''
+    )
+  ] ++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ xorg.libX11 ]
     ++ lib.optionals (withExtraFeatures && stdenv.isDarwin) [ AppKit nghttp2 libgit2 ];
 
   buildFeatures = lib.optional withExtraFeatures "extra";
diff --git a/pkgs/shells/nushell/zstd-pkg-config.patch b/pkgs/shells/nushell/zstd-pkg-config.patch
new file mode 100644
index 0000000000000..762f1f3f0bcbd
--- /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"