From 5f3c07633aa1b3c3d56485a78ece850862f9d1f3 Mon Sep 17 00:00:00 2001 From: Shane Sveller Date: Fri, 29 Jul 2022 10:17:47 -0500 Subject: [PATCH 1/4] nushell: 0.65.0 -> 0.66.2 https://www.nushell.sh/blog/2022-07-26-nushell-0_66.html https://github.com/nushell/nushell/releases/tag/0.66.1 https://github.com/nushell/nushell/releases/tag/0.66.2 https://github.com/nushell/nushell/compare/0.66.0...0.66.2 --- pkgs/shells/nushell/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/shells/nushell/default.nix b/pkgs/shells/nushell/default.nix index 08445c4176a4..1f510a65a302 100644 --- a/pkgs/shells/nushell/default.nix +++ b/pkgs/shells/nushell/default.nix @@ -21,16 +21,16 @@ rustPlatform.buildRustPackage rec { pname = "nushell"; - version = "0.65.0"; + version = "0.66.2"; src = fetchFromGitHub { owner = pname; repo = pname; rev = version; - sha256 = "sha256-KgXhmAOJaAvmNuDqSaW+h6GF5rWYgj8/wn+vz9V9S7M="; + sha256 = "sha256-PaPj2hbObY4wXubN3Mvr0TlpI13Zgkey90qAgpB0qOo="; }; - cargoSha256 = "sha256-YqtM/1p6oP0+E0rYSFPeCbof06E81eC2PZIwkU7J0I4="; + 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 @@ -49,7 +49,8 @@ rustPlatform.buildRustPackage rec { ''; 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 ] From 0d117eb087ba91a866922736887b65fdf3a6d2f8 Mon Sep 17 00:00:00 2001 From: Shane Sveller Date: Sun, 31 Jul 2022 14:15:54 -0500 Subject: [PATCH 2/4] 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 --- pkgs/shells/nushell/default.nix | 22 +++------------- pkgs/shells/nushell/zstd-pkg-config.patch | 31 +++++++++++++++++++++++ 2 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 pkgs/shells/nushell/zstd-pkg-config.patch 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" From c0d73cf864d9b1616ff7f28ddd06cbae6f4da668 Mon Sep 17 00:00:00 2001 From: Shane Sveller Date: Fri, 12 Aug 2022 17:08:14 -0500 Subject: [PATCH 3/4] nushell: Include Apple SDK for libproc.h / bindgen https://github.com/nushell/nushell/commit/9b6b8172761cbeb9000dfef3c2db51fc22a56d8e https://github.com/andrewdavidmackenzie/libproc-rs/releases/tag/v0.12.0 https://github.com/NixOS/nixpkgs/blob/fec8b61321a6597d0a9f93468970e6d2cdb896f9/pkgs/development/libraries/webkitgtk/default.nix#L161-L166 https://github.com/NixOS/nixpkgs/blob/fec8b61321a6597d0a9f93468970e6d2cdb896f9/pkgs/tools/system/btop/default.nix#L32-L37 --- pkgs/shells/nushell/default.nix | 20 +++++++++++++++++++- pkgs/top-level/all-packages.nix | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/pkgs/shells/nushell/default.nix b/pkgs/shells/nushell/default.nix index 7ef45040d12d..f6de5f052830 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,7 +11,10 @@ , xorg , libiconv , AppKit +, Foundation , Security +# darwin.apple_sdk.sdk +, sdk , nghttp2 , libgit2 , withExtraFeatures ? true @@ -40,7 +44,21 @@ rustPlatform.buildRustPackage rec { 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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c17bc68750d4..14dc442608df 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24470,7 +24470,8 @@ with pkgs; nsh = callPackage ../shells/nsh { }; nushell = callPackage ../shells/nushell { - inherit (darwin.apple_sdk.frameworks) AppKit Security; + inherit (darwin.apple_sdk.frameworks) AppKit Foundation Security; + inherit (darwin.apple_sdk) sdk; }; nettools = if stdenv.isLinux From 5d34561c4ada684fe511283e920cc366ff7d9965 Mon Sep 17 00:00:00 2001 From: Shane Sveller Date: Mon, 22 Aug 2022 09:38:08 -0500 Subject: [PATCH 4/4] nushell: 0.66.2 -> 0.67.0 https://www.nushell.sh/blog/2022-08-16-nushell-0_67.html --- pkgs/shells/nushell/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/shells/nushell/default.nix b/pkgs/shells/nushell/default.nix index f6de5f052830..0a4070d50db4 100644 --- a/pkgs/shells/nushell/default.nix +++ b/pkgs/shells/nushell/default.nix @@ -24,16 +24,16 @@ rustPlatform.buildRustPackage rec { pname = "nushell"; - version = "0.66.2"; + version = "0.67.0"; src = fetchFromGitHub { owner = pname; repo = pname; rev = version; - sha256 = "sha256-PaPj2hbObY4wXubN3Mvr0TlpI13Zgkey90qAgpB0qOo="; + sha256 = "sha256-O5uM27DvcpwlZStFFLYRDRtFXzAzUdG7v0phK9LJsSo="; }; - cargoSha256 = "sha256-KRkPVemgK7RDWJi4TqHNqZLwpwUkx+K15u52Do+pqik="; + cargoSha256 = "sha256-eGUI+/Vmqv+BCIQCGoF4Egf3oNyonM3tpt1R3EjIocQ="; # enable pkg-config feature of zstd cargoPatches = [ ./zstd-pkg-config.patch ];