From 9ca9bd1a81f5fbdaf79bf42429c02716d15be7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Pitucha?= Date: Thu, 7 Sep 2023 23:31:03 +1000 Subject: [PATCH] nushellPlugins: format plugin and fix darwin Fix compilation under darwin and add the formats plugin to support ini, ical and others. --- pkgs/shells/nushell/plugins/default.nix | 5 +++-- pkgs/shells/nushell/plugins/formats.nix | 29 +++++++++++++++++++++++++ pkgs/shells/nushell/plugins/gstat.nix | 3 ++- pkgs/top-level/all-packages.nix | 2 +- 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 pkgs/shells/nushell/plugins/formats.nix diff --git a/pkgs/shells/nushell/plugins/default.nix b/pkgs/shells/nushell/plugins/default.nix index e79373da156..44b5b05a739 100644 --- a/pkgs/shells/nushell/plugins/default.nix +++ b/pkgs/shells/nushell/plugins/default.nix @@ -1,6 +1,7 @@ -{ lib, newScope, IOKit, CoreFoundation }: +{ lib, newScope, IOKit, CoreFoundation, Foundation, Security }: lib.makeScope newScope (self: with self; { - gstat = callPackage ./gstat.nix { }; + gstat = callPackage ./gstat.nix { inherit Security; }; + formats = callPackage ./formats.nix { inherit IOKit Foundation; }; query = callPackage ./query.nix { inherit IOKit CoreFoundation; }; }) diff --git a/pkgs/shells/nushell/plugins/formats.nix b/pkgs/shells/nushell/plugins/formats.nix new file mode 100644 index 00000000000..bc63789633a --- /dev/null +++ b/pkgs/shells/nushell/plugins/formats.nix @@ -0,0 +1,29 @@ +{ stdenv +, lib +, rustPlatform +, nushell +, pkg-config +, IOKit +, Foundation +}: + +let + pname = "nushell_plugin_formats"; +in +rustPlatform.buildRustPackage { + inherit pname; + version = "0.84.0"; + src = nushell.src; + cargoHash = "sha256-pwOdSJHd9njR0lr4n2EzCcqRonh0cbBHGZgAJ1l8FEk="; + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ IOKit Foundation ]; + cargoBuildFlags = [ "--package nu_plugin_formats" ]; + doCheck = false; + meta = with lib; { + description = "A formats plugin for Nushell"; + homepage = "https://github.com/nushell/nushell/tree/main/crates/nu_plugin_formats"; + license = licenses.mpl20; + maintainers = with maintainers; [ viraptor ]; + platforms = with platforms; all; + }; +} diff --git a/pkgs/shells/nushell/plugins/gstat.nix b/pkgs/shells/nushell/plugins/gstat.nix index 4cab90c7e05..39af12a6a93 100644 --- a/pkgs/shells/nushell/plugins/gstat.nix +++ b/pkgs/shells/nushell/plugins/gstat.nix @@ -4,6 +4,7 @@ , openssl , nushell , pkg-config +, Security }: let @@ -15,7 +16,7 @@ rustPlatform.buildRustPackage { src = nushell.src; cargoHash = "sha256-RcwCYfIEV0+NbZ99uWaCOLqLap3wZ4qXIsc02fqkBSQ="; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ openssl ]; + buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security ]; cargoBuildFlags = [ "--package nu_plugin_gstat" ]; doCheck = false; # some tests fail meta = with lib; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e4f4f03438d..6ef2e802049 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -28512,7 +28512,7 @@ with pkgs; nu_scripts = callPackage ../shells/nushell/nu_scripts { }; nushellPlugins = callPackage ../shells/nushell/plugins { - inherit (darwin.apple_sdk_11_0.frameworks) IOKit CoreFoundation; + inherit (darwin.apple_sdk_11_0.frameworks) IOKit CoreFoundation Foundation Security; }; nettools = if stdenv.isLinux