nushellPlugins.*: refactor, add checks, mark some as broken (#420675)

This commit is contained in:
Yt 2025-06-29 14:08:49 -04:00 committed by GitHub
commit 67c6a0c938
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 163 additions and 169 deletions

View File

@ -20,6 +20,9 @@
}: }:
let let
# NOTE: when updating this to a new non-patch version, please also try to
# update the plugins. Plugins only work if they are compiled for the same
# major/minor version.
version = "0.105.1"; version = "0.105.1";
in in
rustPlatform.buildRustPackage { rustPlatform.buildRustPackage {

View File

@ -1,53 +1,40 @@
{ {
stdenv, stdenv,
runCommand,
lib, lib,
rustPlatform, rustPlatform,
pkg-config, pkg-config,
nix-update-script, nix-update-script,
fetchFromGitHub, fetchFromGitHub,
dbus, dbus,
nushell,
nushell_plugin_dbus,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage (finalAttrs: {
pname = "nu_plugin_dbus"; pname = "nu_plugin_dbus";
version = "0.14.0"; version = "0.14.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "devyn"; owner = "devyn";
repo = pname; repo = "nu_plugin_dbus";
rev = version; tag = finalAttrs.version;
hash = "sha256-Ga+1zFwS/v+3iKVEz7TFmJjyBW/gq6leHeyH2vjawto="; hash = "sha256-Ga+1zFwS/v+3iKVEz7TFmJjyBW/gq6leHeyH2vjawto=";
}; };
useFetchCargoVendor = true;
cargoHash = "sha256-7pD5LA1ytO7VqFnHwgf7vW9eS3olnZBgdsj+rmcHkbU="; cargoHash = "sha256-7pD5LA1ytO7VqFnHwgf7vW9eS3olnZBgdsj+rmcHkbU=";
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
buildInputs = [ dbus ]; buildInputs = [ dbus ];
passthru = { passthru.updateScript = nix-update-script { };
updateScript = nix-update-script { };
tests.check =
let
nu = lib.getExe nushell;
plugin = lib.getExe nushell_plugin_dbus;
in
runCommand "${pname}-test" { } ''
touch $out
${nu} -n -c "plugin add --plugin-config $out ${plugin}"
${nu} -n -c "plugin use --plugin-config $out dbus"
'';
};
meta = with lib; { meta = {
description = "Nushell plugin for communicating with D-Bus"; description = "Nushell plugin for communicating with D-Bus";
mainProgram = "nu_plugin_dbus"; mainProgram = "nu_plugin_dbus";
homepage = "https://github.com/devyn/nu_plugin_dbus"; homepage = "https://github.com/devyn/nu_plugin_dbus";
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ aftix ]; maintainers = with lib.maintainers; [ aftix ];
platforms = with platforms; linux; platforms = lib.platforms.linux;
# "Plugin `dbus` is compiled for nushell version 0.101.0, which is not
# compatible with version 0.105.1"
broken = true;
}; };
} })

View File

@ -3,10 +3,46 @@
config, config,
newScope, newScope,
dbus, dbus,
versionCheckHook,
nushell,
runCommand,
}: }:
lib.makeScope newScope ( lib.makeScope newScope (
self: self:
lib.mapAttrs
(
_n: p:
let
# add two checks:
# - `versionCheckhook`, checks wether it's a binary that is able to
# display its own version
# - A check which loads the plugin into the current version of nushell,
# to detect incompatibilities (plugins are compiled for very specific
# versions of nushell). If this fails, either update the plugin or mark
# as broken.
withChecks = p.overrideAttrs (
final: _prev: {
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
passthru.tests.loadCheck =
let
nu = lib.getExe nushell;
plugin = lib.getExe withChecks;
in
runCommand "test-load-${final.pname}" { } ''
touch $out
${nu} -n -c "plugin add --plugin-config $out ${plugin}"
${nu} -n -c "plugin use --plugin-config $out ${plugin}"
'';
}
);
in
withChecks
)
(
with self; with self;
{ {
gstat = callPackage ./gstat.nix { }; gstat = callPackage ./gstat.nix { };
@ -18,7 +54,6 @@ lib.makeScope newScope (
highlight = callPackage ./highlight.nix { }; highlight = callPackage ./highlight.nix { };
dbus = callPackage ./dbus.nix { dbus = callPackage ./dbus.nix {
inherit dbus; inherit dbus;
nushell_plugin_dbus = self.dbus;
}; };
skim = callPackage ./skim.nix { }; skim = callPackage ./skim.nix { };
semver = callPackage ./semver.nix { }; semver = callPackage ./semver.nix { };
@ -27,4 +62,5 @@ lib.makeScope newScope (
// lib.optionalAttrs config.allowAliases { // lib.optionalAttrs config.allowAliases {
regex = throw "`nu_plugin_regex` is no longer compatible with the current Nushell release."; regex = throw "`nu_plugin_regex` is no longer compatible with the current Nushell release.";
} }
)
) )

View File

@ -7,32 +7,27 @@
nix-update-script, nix-update-script,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage (finalAttrs: {
pname = "nushell_plugin_formats"; pname = "nu_plugin_formats";
inherit (nushell) version src cargoHash; inherit (nushell) version src cargoHash;
useFetchCargoVendor = true;
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
cargoBuildFlags = [ "--package nu_plugin_formats" ];
checkPhase = '' buildAndTestSubdir = "crates/nu_plugin_formats";
cargo test --manifest-path crates/nu_plugin_formats/Cargo.toml
'';
passthru.updateScript = nix-update-script { passthru.updateScript = nix-update-script {
# Skip the version check and only check the hash because we inherit version from nushell. # Skip the version check and only check the hash because we inherit version from nushell.
extraArgs = [ "--version=skip" ]; extraArgs = [ "--version=skip" ];
}; };
meta = with lib; { meta = {
description = "Formats plugin for Nushell"; description = "Formats plugin for Nushell";
mainProgram = "nu_plugin_formats"; mainProgram = "nu_plugin_formats";
homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_formats"; homepage = "https://github.com/nushell/nushell/tree/${finalAttrs.version}/crates/nu_plugin_formats";
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ maintainers = with lib.maintainers; [
viraptor viraptor
aidalgol aidalgol
]; ];
platforms = with platforms; all;
}; };
} })

View File

@ -8,33 +8,28 @@
nix-update-script, nix-update-script,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage (finalAttrs: {
pname = "nushell_plugin_gstat"; pname = "nu_plugin_gstat";
inherit (nushell) version src cargoHash; inherit (nushell) version src cargoHash;
useFetchCargoVendor = true;
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
buildInputs = [ openssl ]; buildInputs = [ openssl ];
cargoBuildFlags = [ "--package nu_plugin_gstat" ];
checkPhase = '' buildAndTestSubdir = "crates/nu_plugin_gstat";
cargo test --manifest-path crates/nu_plugin_gstat/Cargo.toml
'';
passthru.updateScript = nix-update-script { passthru.updateScript = nix-update-script {
# Skip the version check and only check the hash because we inherit version from nushell. # Skip the version check and only check the hash because we inherit version from nushell.
extraArgs = [ "--version=skip" ]; extraArgs = [ "--version=skip" ];
}; };
meta = with lib; { meta = {
description = "Git status plugin for Nushell"; description = "Git status plugin for Nushell";
mainProgram = "nu_plugin_gstat"; mainProgram = "nu_plugin_gstat";
homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_gstat"; homepage = "https://github.com/nushell/nushell/tree/${finalAttrs.version}/crates/nu_plugin_gstat";
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ maintainers = with lib.maintainers; [
mrkkrp mrkkrp
aidalgol aidalgol
]; ];
platforms = with platforms; all;
}; };
} })

View File

@ -7,30 +7,31 @@
fetchFromGitHub, fetchFromGitHub,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage (finalAttrs: {
pname = "nushell_plugin_hcl"; pname = "nu_plugin_hcl";
version = "0.105.1"; version = "0.105.1";
src = fetchFromGitHub { src = fetchFromGitHub {
repo = "nu_plugin_hcl";
owner = "Yethal"; owner = "Yethal";
tag = version; repo = "nu_plugin_hcl";
tag = finalAttrs.version;
hash = "sha256-V1RKZ0Tqq0LTGbHS2lLMyf6M4AgAgWSzkDeFUighO4k="; hash = "sha256-V1RKZ0Tqq0LTGbHS2lLMyf6M4AgAgWSzkDeFUighO4k=";
}; };
useFetchCargoVendor = true;
cargoHash = "sha256-UbqKfQxut+76yB9F1gT8FEapbX/kHvaShltHpWUdhgc="; cargoHash = "sha256-UbqKfQxut+76yB9F1gT8FEapbX/kHvaShltHpWUdhgc=";
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
cargoBuildFlags = [ "--package nu_plugin_hcl" ];
# there are no tests
doCheck = false;
passthru.updateScript = nix-update-script { }; passthru.updateScript = nix-update-script { };
meta = with lib; { meta = {
description = "Nushell plugin for parsing Hashicorp Configuration Language files"; description = "Nushell plugin for parsing Hashicorp Configuration Language files";
mainProgram = "nu_plugin_hcl"; mainProgram = "nu_plugin_hcl";
homepage = "https://github.com/Yethal/nu_plugin_hcl"; homepage = "https://github.com/Yethal/nu_plugin_hcl";
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ yethal ]; maintainers = with lib.maintainers; [ yethal ];
platforms = with platforms; all;
}; };
} })

View File

@ -7,36 +7,32 @@
fetchFromGitHub, fetchFromGitHub,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage (finalAttrs: {
pname = "nushell_plugin_highlight"; pname = "nu_plugin_highlight";
version = "1.4.7+0.105.1"; version = "1.4.7+0.105.1";
src = fetchFromGitHub { src = fetchFromGitHub {
repo = "nu-plugin-highlight";
owner = "cptpiepmatz"; owner = "cptpiepmatz";
rev = "refs/tags/v${version}"; repo = "nu-plugin-highlight";
tag = "v${finalAttrs.version}";
hash = "sha256-0jU0c2v3q3RXX/zZlwTBwAdO8HEaROFNV/F4GBFaMt0="; hash = "sha256-0jU0c2v3q3RXX/zZlwTBwAdO8HEaROFNV/F4GBFaMt0=";
fetchSubmodules = true; fetchSubmodules = true;
}; };
useFetchCargoVendor = true;
cargoHash = "sha256-UD1IzegajAG13iAOERymDa10JbuhvORVZ8gHy9d6buE="; cargoHash = "sha256-UD1IzegajAG13iAOERymDa10JbuhvORVZ8gHy9d6buE=";
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
cargoBuildFlags = [ "--package nu_plugin_highlight" ];
checkPhase = '' # there are no tests
cargo test doCheck = false;
'';
passthru.updateScript = nix-update-script { }; passthru.updateScript = nix-update-script { };
meta = with lib; { meta = {
description = "A nushell plugin for syntax highlighting."; description = "A nushell plugin for syntax highlighting.";
mainProgram = "nu_plugin_highlight"; mainProgram = "nu_plugin_highlight";
homepage = "https://github.com/cptpiepmatz/nu-plugin-highlight"; homepage = "https://github.com/cptpiepmatz/nu-plugin-highlight";
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ mgttlinger ]; maintainers = with lib.maintainers; [ mgttlinger ];
platforms = with platforms; all;
}; };
} })

View File

@ -1,33 +1,39 @@
{ {
stdenv,
lib, lib,
rustPlatform, rustPlatform,
fetchFromGitHub, fetchFromGitHub,
nix-update-script, nix-update-script,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage (finalAttrs: {
pname = "nushell_plugin_net"; pname = "nu_plugin_net";
version = "1.10.0"; version = "1.10.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "fennewald"; owner = "fennewald";
repo = "nu_plugin_net"; repo = "nu_plugin_net";
rev = "refs/tags/${version}"; tag = "${finalAttrs.version}";
hash = "sha256-HiNydU40FprxVmRRZtnXom2kFYI04mbeuGTq8+BMh7o="; hash = "sha256-HiNydU40FprxVmRRZtnXom2kFYI04mbeuGTq8+BMh7o=";
}; };
useFetchCargoVendor = true;
cargoHash = "sha256-tq0XqY2B7tC2ep8vH6T3nkAqxqhniqzYnhbkfB3SbHU="; cargoHash = "sha256-tq0XqY2B7tC2ep8vH6T3nkAqxqhniqzYnhbkfB3SbHU=";
nativeBuildInputs = [ rustPlatform.bindgenHook ]; nativeBuildInputs = lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
# there are no tests
doCheck = false;
passthru.updateScript = nix-update-script { }; passthru.updateScript = nix-update-script { };
meta = with lib; { meta = {
description = "Nushell plugin to list system network interfaces"; description = "Nushell plugin to list system network interfaces";
homepage = "https://github.com/fennewald/nu_plugin_net"; homepage = "https://github.com/fennewald/nu_plugin_net";
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ happysalada ]; maintainers = with lib.maintainers; [ happysalada ];
mainProgram = "nu_plugin_net"; mainProgram = "nu_plugin_net";
# "Plugin `net` is compiled for nushell version 0.104.0, which is not
# compatible with version 0.105.1"
broken = true;
}; };
} })

View File

@ -8,33 +8,29 @@
nix-update-script, nix-update-script,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage (finalAttrs: {
pname = "nushell_plugin_polars"; pname = "nu_plugin_polars";
inherit (nushell) version src cargoHash; inherit (nushell) version src cargoHash;
useFetchCargoVendor = true;
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
buildInputs = [ openssl ]; buildInputs = [ openssl ];
cargoBuildFlags = [ "--package nu_plugin_polars" ];
checkPhase = '' buildAndTestSubdir = "crates/nu_plugin_polars";
# test failed without enough columns
cargo test --manifest-path crates/nu_plugin_polars/Cargo.toml -- \ checkFlags = [
--skip=dataframe::command::core::to_repr::test::test_examples "--skip=dataframe::command::core::to_repr::test::test_examples"
''; ];
passthru.updateScript = nix-update-script { passthru.updateScript = nix-update-script {
# Skip the version check and only check the hash because we inherit version from nushell. # Skip the version check and only check the hash because we inherit version from nushell.
extraArgs = [ "--version=skip" ]; extraArgs = [ "--version=skip" ];
}; };
meta = with lib; { meta = {
description = "Nushell dataframe plugin commands based on polars"; description = "Nushell dataframe plugin commands based on polars";
mainProgram = "nu_plugin_polars"; mainProgram = "nu_plugin_polars";
homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_polars"; homepage = "https://github.com/nushell/nushell/tree/${finalAttrs.version}/crates/nu_plugin_polars";
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ joaquintrinanes ]; maintainers = with lib.maintainers; [ joaquintrinanes ];
platforms = with platforms; all;
}; };
} })

View File

@ -9,21 +9,17 @@
curl, curl,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage (finalAttrs: {
pname = "nushell_plugin_query"; pname = "nu_plugin_query";
inherit (nushell) version src cargoHash; inherit (nushell) version src cargoHash;
useFetchCargoVendor = true;
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
buildInputs = [ buildInputs = [
openssl openssl
curl curl
]; ];
cargoBuildFlags = [ "--package nu_plugin_query" ];
checkPhase = '' buildAndTestSubdir = "crates/nu_plugin_query";
cargo test --manifest-path crates/nu_plugin_query/Cargo.toml
'';
passthru.updateScript = nix-update-script { passthru.updateScript = nix-update-script {
# Skip the version check and only check the hash because we inherit version from nushell. # Skip the version check and only check the hash because we inherit version from nushell.
@ -33,12 +29,11 @@ rustPlatform.buildRustPackage rec {
meta = { meta = {
description = "Nushell plugin to query JSON, XML, and various web data"; description = "Nushell plugin to query JSON, XML, and various web data";
mainProgram = "nu_plugin_query"; mainProgram = "nu_plugin_query";
homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_query"; homepage = "https://github.com/nushell/nushell/tree/${finalAttrs.version}/crates/nu_plugin_query";
license = lib.licenses.mit; license = lib.licenses.mit;
maintainers = with lib.maintainers; [ maintainers = with lib.maintainers; [
happysalada happysalada
aidalgol aidalgol
]; ];
platforms = lib.platforms.all;
}; };
} })

View File

@ -1,50 +1,33 @@
{ {
stdenv, stdenv,
runCommand,
lib, lib,
rustPlatform, rustPlatform,
nix-update-script, nix-update-script,
fetchFromGitHub, fetchFromGitHub,
nushell,
skim,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage (finalAttrs: {
pname = "nu_plugin_skim"; pname = "nu_plugin_skim";
version = "0.15.0"; version = "0.15.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "idanarye"; owner = "idanarye";
repo = pname; repo = "nu_plugin_skim";
tag = "v${version}"; tag = "v${finalAttrs.version}";
hash = "sha256-8gO6pT40zBlFxPRapIO9qpMI9whutttqYgOPr91B9Ec="; hash = "sha256-8gO6pT40zBlFxPRapIO9qpMI9whutttqYgOPr91B9Ec=";
}; };
useFetchCargoVendor = true;
cargoHash = "sha256-2poE7Nnwe5rRoU8WknEgzX68z+y9ZplX53v8FURzxmE="; cargoHash = "sha256-2poE7Nnwe5rRoU8WknEgzX68z+y9ZplX53v8FURzxmE=";
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ rustPlatform.bindgenHook ]; nativeBuildInputs = lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
passthru = { passthru.updateScript = nix-update-script { };
updateScript = nix-update-script { };
tests.check =
let
nu = lib.getExe nushell;
plugin = lib.getExe skim;
in
runCommand "${pname}-test" { } ''
touch $out
${nu} -n -c "plugin add --plugin-config $out ${plugin}"
${nu} -n -c "plugin use --plugin-config $out skim"
'';
};
meta = with lib; { meta = {
description = "A nushell plugin that adds integrates the skim fuzzy finder"; description = "A nushell plugin that adds integrates the skim fuzzy finder";
mainProgram = "nu_plugin_skim"; mainProgram = "nu_plugin_skim";
homepage = "https://github.com/idanarye/nu_plugin_skim"; homepage = "https://github.com/idanarye/nu_plugin_skim";
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ aftix ]; maintainers = with lib.maintainers; [ aftix ];
platforms = platforms.all;
}; };
} })

View File

@ -7,30 +7,31 @@
fetchFromGitHub, fetchFromGitHub,
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage (finalAttrs: {
pname = "nushell_plugin_units"; pname = "nu_plugin_units";
version = "0.1.6"; version = "0.1.6";
src = fetchFromGitHub { src = fetchFromGitHub {
repo = "nu_plugin_units";
owner = "JosephTLyons"; owner = "JosephTLyons";
rev = "v${version}"; repo = "nu_plugin_units";
tag = "v${finalAttrs.version}";
hash = "sha256-1KyuUaWN+OiGpo8Ohc/8B+nisdb8uT+T3qBu+JbaVYo="; hash = "sha256-1KyuUaWN+OiGpo8Ohc/8B+nisdb8uT+T3qBu+JbaVYo=";
}; };
useFetchCargoVendor = true;
cargoHash = "sha256-LYVwFM8znN96LwOwRnauehrucSqHnKNPoMzl2HRczww="; cargoHash = "sha256-LYVwFM8znN96LwOwRnauehrucSqHnKNPoMzl2HRczww=";
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
cargoBuildFlags = [ "--package nu_plugin_units" ];
passthru.updateScript = nix-update-script { }; passthru.updateScript = nix-update-script { };
meta = with lib; { meta = {
description = "A nushell plugin for easily converting between common units."; description = "Nushell plugin for easily converting between common units";
mainProgram = "nu_plugin_units"; mainProgram = "nu_plugin_units";
homepage = "https://github.com/JosephTLyons/nu_plugin_units"; homepage = "https://github.com/JosephTLyons/nu_plugin_units";
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ mgttlinger ]; maintainers = with lib.maintainers; [ mgttlinger ];
platforms = with platforms; all; # "Plugin `units` is compiled for nushell version 0.104.0, which is not
# compatible with version 0.105.1"
broken = true;
}; };
} })