From 923ad862cdd69224ccbbe70df7a5aefb6f4cf907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20Tri=C3=B1anes?= Date: Tue, 4 Jun 2024 19:05:42 +0200 Subject: [PATCH] nu_plugin_polars: init at 0.94.1 --- pkgs/shells/nushell/plugins/default.nix | 1 + pkgs/shells/nushell/plugins/polars.nix | 45 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 pkgs/shells/nushell/plugins/polars.nix diff --git a/pkgs/shells/nushell/plugins/default.nix b/pkgs/shells/nushell/plugins/default.nix index eb8bbe14c281..cdc35b15773b 100644 --- a/pkgs/shells/nushell/plugins/default.nix +++ b/pkgs/shells/nushell/plugins/default.nix @@ -3,6 +3,7 @@ lib.makeScope newScope (self: with self; { gstat = callPackage ./gstat.nix { inherit Security; }; formats = callPackage ./formats.nix { inherit IOKit Foundation; }; + polars = callPackage ./polars.nix { inherit IOKit Foundation; }; query = callPackage ./query.nix { inherit IOKit CoreFoundation; }; regex = throw "`nu_plugin_regex` is no longer compatible with the current Nushell release."; net = callPackage ./net.nix { inherit IOKit CoreFoundation; }; diff --git a/pkgs/shells/nushell/plugins/polars.nix b/pkgs/shells/nushell/plugins/polars.nix new file mode 100644 index 000000000000..4d2c853892cf --- /dev/null +++ b/pkgs/shells/nushell/plugins/polars.nix @@ -0,0 +1,45 @@ +{ + stdenv, + lib, + rustPlatform, + openssl, + nushell, + pkg-config, + IOKit, + Foundation, + nix-update-script, +}: + +rustPlatform.buildRustPackage rec { + pname = "nushell_plugin_polars"; + inherit (nushell) version src; + + cargoHash = "sha256-GkVX12MEHFP4g183zUzOUn4MNeTEBEpB+D5s0OXa4nc="; + + nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; + buildInputs = + [ openssl ] + ++ lib.optionals stdenv.isDarwin [ + IOKit + Foundation + ]; + cargoBuildFlags = [ "--package nu_plugin_polars" ]; + + checkPhase = '' + cargo test --manifest-path crates/nu_plugin_polars/Cargo.toml + ''; + + passthru.updateScript = nix-update-script { + # Skip the version check and only check the hash because we inherit version from nushell. + extraArgs = [ "--version=skip" ]; + }; + + meta = with lib; { + description = "Nushell dataframe plugin commands based on polars."; + mainProgram = "nu_plugin_polars"; + homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_polars"; + license = licenses.mit; + maintainers = with maintainers; [ joaquintrinanes ]; + platforms = with platforms; all; + }; +}