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

Yt 67c6a0c9 8974d5be

+3
pkgs/shells/nushell/default.nix
···
}:
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";
in
rustPlatform.buildRustPackage {
+12 -25
pkgs/shells/nushell/plugins/dbus.nix
···
{
stdenv,
-
runCommand,
lib,
rustPlatform,
pkg-config,
nix-update-script,
fetchFromGitHub,
dbus,
-
nushell,
-
nushell_plugin_dbus,
}:
-
rustPlatform.buildRustPackage rec {
+
rustPlatform.buildRustPackage (finalAttrs: {
pname = "nu_plugin_dbus";
version = "0.14.0";
src = fetchFromGitHub {
owner = "devyn";
-
repo = pname;
-
rev = version;
+
repo = "nu_plugin_dbus";
+
tag = finalAttrs.version;
hash = "sha256-Ga+1zFwS/v+3iKVEz7TFmJjyBW/gq6leHeyH2vjawto=";
};
-
useFetchCargoVendor = true;
cargoHash = "sha256-7pD5LA1ytO7VqFnHwgf7vW9eS3olnZBgdsj+rmcHkbU=";
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
buildInputs = [ dbus ];
-
passthru = {
-
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"
-
'';
-
};
+
passthru.updateScript = nix-update-script { };
-
meta = with lib; {
+
meta = {
description = "Nushell plugin for communicating with D-Bus";
mainProgram = "nu_plugin_dbus";
homepage = "https://github.com/devyn/nu_plugin_dbus";
-
license = licenses.mit;
-
maintainers = with maintainers; [ aftix ];
-
platforms = with platforms; linux;
+
license = lib.licenses.mit;
+
maintainers = with lib.maintainers; [ aftix ];
+
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;
};
-
}
+
})
+56 -20
pkgs/shells/nushell/plugins/default.nix
···
config,
newScope,
dbus,
+
versionCheckHook,
+
nushell,
+
runCommand,
}:
lib.makeScope newScope (
self:
-
with self;
-
{
-
gstat = callPackage ./gstat.nix { };
-
formats = callPackage ./formats.nix { };
-
polars = callPackage ./polars.nix { };
-
query = callPackage ./query.nix { };
-
net = callPackage ./net.nix { };
-
units = callPackage ./units.nix { };
-
highlight = callPackage ./highlight.nix { };
-
dbus = callPackage ./dbus.nix {
-
inherit dbus;
-
nushell_plugin_dbus = self.dbus;
-
};
-
skim = callPackage ./skim.nix { };
-
semver = callPackage ./semver.nix { };
-
hcl = callPackage ./hcl.nix { };
-
}
-
// lib.optionalAttrs config.allowAliases {
-
regex = throw "`nu_plugin_regex` is no longer compatible with the current Nushell release.";
-
}
+
+
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;
+
{
+
gstat = callPackage ./gstat.nix { };
+
formats = callPackage ./formats.nix { };
+
polars = callPackage ./polars.nix { };
+
query = callPackage ./query.nix { };
+
net = callPackage ./net.nix { };
+
units = callPackage ./units.nix { };
+
highlight = callPackage ./highlight.nix { };
+
dbus = callPackage ./dbus.nix {
+
inherit dbus;
+
};
+
skim = callPackage ./skim.nix { };
+
semver = callPackage ./semver.nix { };
+
hcl = callPackage ./hcl.nix { };
+
}
+
// lib.optionalAttrs config.allowAliases {
+
regex = throw "`nu_plugin_regex` is no longer compatible with the current Nushell release.";
+
}
+
)
)
+8 -13
pkgs/shells/nushell/plugins/formats.nix
···
nix-update-script,
}:
-
rustPlatform.buildRustPackage rec {
-
pname = "nushell_plugin_formats";
+
rustPlatform.buildRustPackage (finalAttrs: {
+
pname = "nu_plugin_formats";
inherit (nushell) version src cargoHash;
-
useFetchCargoVendor = true;
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
-
cargoBuildFlags = [ "--package nu_plugin_formats" ];
-
checkPhase = ''
-
cargo test --manifest-path crates/nu_plugin_formats/Cargo.toml
-
'';
+
buildAndTestSubdir = "crates/nu_plugin_formats";
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; {
+
meta = {
description = "Formats plugin for Nushell";
mainProgram = "nu_plugin_formats";
-
homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_formats";
-
license = licenses.mit;
-
maintainers = with maintainers; [
+
homepage = "https://github.com/nushell/nushell/tree/${finalAttrs.version}/crates/nu_plugin_formats";
+
license = lib.licenses.mit;
+
maintainers = with lib.maintainers; [
viraptor
aidalgol
];
-
platforms = with platforms; all;
};
-
}
+
})
+8 -13
pkgs/shells/nushell/plugins/gstat.nix
···
nix-update-script,
}:
-
rustPlatform.buildRustPackage rec {
-
pname = "nushell_plugin_gstat";
+
rustPlatform.buildRustPackage (finalAttrs: {
+
pname = "nu_plugin_gstat";
inherit (nushell) version src cargoHash;
-
useFetchCargoVendor = true;
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
buildInputs = [ openssl ];
-
cargoBuildFlags = [ "--package nu_plugin_gstat" ];
-
checkPhase = ''
-
cargo test --manifest-path crates/nu_plugin_gstat/Cargo.toml
-
'';
+
buildAndTestSubdir = "crates/nu_plugin_gstat";
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; {
+
meta = {
description = "Git status plugin for Nushell";
mainProgram = "nu_plugin_gstat";
-
homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_gstat";
-
license = licenses.mit;
-
maintainers = with maintainers; [
+
homepage = "https://github.com/nushell/nushell/tree/${finalAttrs.version}/crates/nu_plugin_gstat";
+
license = lib.licenses.mit;
+
maintainers = with lib.maintainers; [
mrkkrp
aidalgol
];
-
platforms = with platforms; all;
};
-
}
+
})
+12 -11
pkgs/shells/nushell/plugins/hcl.nix
···
fetchFromGitHub,
}:
-
rustPlatform.buildRustPackage rec {
-
pname = "nushell_plugin_hcl";
+
rustPlatform.buildRustPackage (finalAttrs: {
+
pname = "nu_plugin_hcl";
version = "0.105.1";
src = fetchFromGitHub {
-
repo = "nu_plugin_hcl";
owner = "Yethal";
-
tag = version;
+
repo = "nu_plugin_hcl";
+
tag = finalAttrs.version;
hash = "sha256-V1RKZ0Tqq0LTGbHS2lLMyf6M4AgAgWSzkDeFUighO4k=";
};
-
useFetchCargoVendor = true;
+
cargoHash = "sha256-UbqKfQxut+76yB9F1gT8FEapbX/kHvaShltHpWUdhgc=";
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 { };
-
meta = with lib; {
+
meta = {
description = "Nushell plugin for parsing Hashicorp Configuration Language files";
mainProgram = "nu_plugin_hcl";
homepage = "https://github.com/Yethal/nu_plugin_hcl";
-
license = licenses.mit;
-
maintainers = with maintainers; [ yethal ];
-
platforms = with platforms; all;
+
license = lib.licenses.mit;
+
maintainers = with lib.maintainers; [ yethal ];
};
-
}
+
})
+10 -14
pkgs/shells/nushell/plugins/highlight.nix
···
fetchFromGitHub,
}:
-
rustPlatform.buildRustPackage rec {
-
pname = "nushell_plugin_highlight";
+
rustPlatform.buildRustPackage (finalAttrs: {
+
pname = "nu_plugin_highlight";
version = "1.4.7+0.105.1";
src = fetchFromGitHub {
-
repo = "nu-plugin-highlight";
owner = "cptpiepmatz";
-
rev = "refs/tags/v${version}";
+
repo = "nu-plugin-highlight";
+
tag = "v${finalAttrs.version}";
hash = "sha256-0jU0c2v3q3RXX/zZlwTBwAdO8HEaROFNV/F4GBFaMt0=";
fetchSubmodules = true;
};
-
useFetchCargoVendor = true;
cargoHash = "sha256-UD1IzegajAG13iAOERymDa10JbuhvORVZ8gHy9d6buE=";
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
-
cargoBuildFlags = [ "--package nu_plugin_highlight" ];
-
checkPhase = ''
-
cargo test
-
'';
+
# there are no tests
+
doCheck = false;
passthru.updateScript = nix-update-script { };
-
meta = with lib; {
+
meta = {
description = "A nushell plugin for syntax highlighting.";
mainProgram = "nu_plugin_highlight";
homepage = "https://github.com/cptpiepmatz/nu-plugin-highlight";
-
license = licenses.mit;
-
maintainers = with maintainers; [ mgttlinger ];
-
platforms = with platforms; all;
+
license = lib.licenses.mit;
+
maintainers = with lib.maintainers; [ mgttlinger ];
};
-
}
+
})
+15 -9
pkgs/shells/nushell/plugins/net.nix
···
{
+
stdenv,
lib,
rustPlatform,
fetchFromGitHub,
nix-update-script,
}:
-
rustPlatform.buildRustPackage rec {
-
pname = "nushell_plugin_net";
+
rustPlatform.buildRustPackage (finalAttrs: {
+
pname = "nu_plugin_net";
version = "1.10.0";
src = fetchFromGitHub {
owner = "fennewald";
repo = "nu_plugin_net";
-
rev = "refs/tags/${version}";
+
tag = "${finalAttrs.version}";
hash = "sha256-HiNydU40FprxVmRRZtnXom2kFYI04mbeuGTq8+BMh7o=";
};
-
useFetchCargoVendor = true;
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 { };
-
meta = with lib; {
+
meta = {
description = "Nushell plugin to list system network interfaces";
homepage = "https://github.com/fennewald/nu_plugin_net";
-
license = licenses.mit;
-
maintainers = with maintainers; [ happysalada ];
+
license = lib.licenses.mit;
+
maintainers = with lib.maintainers; [ happysalada ];
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;
};
-
}
+
})
+12 -16
pkgs/shells/nushell/plugins/polars.nix
···
nix-update-script,
}:
-
rustPlatform.buildRustPackage rec {
-
pname = "nushell_plugin_polars";
+
rustPlatform.buildRustPackage (finalAttrs: {
+
pname = "nu_plugin_polars";
inherit (nushell) version src cargoHash;
-
useFetchCargoVendor = true;
-
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
buildInputs = [ openssl ];
-
cargoBuildFlags = [ "--package nu_plugin_polars" ];
-
checkPhase = ''
-
# test failed without enough columns
-
cargo test --manifest-path crates/nu_plugin_polars/Cargo.toml -- \
-
--skip=dataframe::command::core::to_repr::test::test_examples
-
'';
+
buildAndTestSubdir = "crates/nu_plugin_polars";
+
+
checkFlags = [
+
"--skip=dataframe::command::core::to_repr::test::test_examples"
+
];
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; {
+
meta = {
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;
+
homepage = "https://github.com/nushell/nushell/tree/${finalAttrs.version}/crates/nu_plugin_polars";
+
license = lib.licenses.mit;
+
maintainers = with lib.maintainers; [ joaquintrinanes ];
};
-
}
+
})
+5 -10
pkgs/shells/nushell/plugins/query.nix
···
curl,
}:
-
rustPlatform.buildRustPackage rec {
-
pname = "nushell_plugin_query";
+
rustPlatform.buildRustPackage (finalAttrs: {
+
pname = "nu_plugin_query";
inherit (nushell) version src cargoHash;
-
useFetchCargoVendor = true;
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
buildInputs = [
openssl
curl
];
-
cargoBuildFlags = [ "--package nu_plugin_query" ];
-
checkPhase = ''
-
cargo test --manifest-path crates/nu_plugin_query/Cargo.toml
-
'';
+
buildAndTestSubdir = "crates/nu_plugin_query";
passthru.updateScript = nix-update-script {
# Skip the version check and only check the hash because we inherit version from nushell.
···
meta = {
description = "Nushell plugin to query JSON, XML, and various web data";
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;
maintainers = with lib.maintainers; [
happysalada
aidalgol
];
-
platforms = lib.platforms.all;
};
-
}
+
})
+9 -26
pkgs/shells/nushell/plugins/skim.nix
···
{
stdenv,
-
runCommand,
lib,
rustPlatform,
nix-update-script,
fetchFromGitHub,
-
nushell,
-
skim,
}:
-
rustPlatform.buildRustPackage rec {
+
rustPlatform.buildRustPackage (finalAttrs: {
pname = "nu_plugin_skim";
version = "0.15.0";
src = fetchFromGitHub {
owner = "idanarye";
-
repo = pname;
-
tag = "v${version}";
+
repo = "nu_plugin_skim";
+
tag = "v${finalAttrs.version}";
hash = "sha256-8gO6pT40zBlFxPRapIO9qpMI9whutttqYgOPr91B9Ec=";
};
-
useFetchCargoVendor = true;
cargoHash = "sha256-2poE7Nnwe5rRoU8WknEgzX68z+y9ZplX53v8FURzxmE=";
-
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ rustPlatform.bindgenHook ];
+
nativeBuildInputs = lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
-
passthru = {
-
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"
-
'';
-
};
+
passthru.updateScript = nix-update-script { };
-
meta = with lib; {
+
meta = {
description = "A nushell plugin that adds integrates the skim fuzzy finder";
mainProgram = "nu_plugin_skim";
homepage = "https://github.com/idanarye/nu_plugin_skim";
-
license = licenses.mit;
-
maintainers = with maintainers; [ aftix ];
-
platforms = platforms.all;
+
license = lib.licenses.mit;
+
maintainers = with lib.maintainers; [ aftix ];
};
-
}
+
})
+13 -12
pkgs/shells/nushell/plugins/units.nix
···
fetchFromGitHub,
}:
-
rustPlatform.buildRustPackage rec {
-
pname = "nushell_plugin_units";
+
rustPlatform.buildRustPackage (finalAttrs: {
+
pname = "nu_plugin_units";
version = "0.1.6";
src = fetchFromGitHub {
+
owner = "JosephTLyons";
repo = "nu_plugin_units";
-
owner = "JosephTLyons";
-
rev = "v${version}";
+
tag = "v${finalAttrs.version}";
hash = "sha256-1KyuUaWN+OiGpo8Ohc/8B+nisdb8uT+T3qBu+JbaVYo=";
};
-
useFetchCargoVendor = true;
+
cargoHash = "sha256-LYVwFM8znN96LwOwRnauehrucSqHnKNPoMzl2HRczww=";
nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ];
-
cargoBuildFlags = [ "--package nu_plugin_units" ];
passthru.updateScript = nix-update-script { };
-
meta = with lib; {
-
description = "A nushell plugin for easily converting between common units.";
+
meta = {
+
description = "Nushell plugin for easily converting between common units";
mainProgram = "nu_plugin_units";
homepage = "https://github.com/JosephTLyons/nu_plugin_units";
-
license = licenses.mit;
-
maintainers = with maintainers; [ mgttlinger ];
-
platforms = with platforms; all;
+
license = lib.licenses.mit;
+
maintainers = with lib.maintainers; [ mgttlinger ];
+
# "Plugin `units` is compiled for nushell version 0.104.0, which is not
+
# compatible with version 0.105.1"
+
broken = true;
};
-
}
+
})