Skip to content
Merged
3 changes: 3 additions & 0 deletions pkgs/shells/nushell/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
}:

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.104.0";
in

Expand Down
34 changes: 9 additions & 25 deletions pkgs/shells/nushell/plugins/dbus.nix
Original file line number Diff line number Diff line change
@@ -1,53 +1,37 @@
{
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;
};
}
})
74 changes: 55 additions & 19 deletions pkgs/shells/nushell/plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,63 @@
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 { };
}
// 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 { };
}
// lib.optionalAttrs config.allowAliases {
regex = throw "`nu_plugin_regex` is no longer compatible with the current Nushell release.";
}
)
)
21 changes: 8 additions & 13 deletions pkgs/shells/nushell/plugins/formats.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,27 @@
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;
};
}
})
21 changes: 8 additions & 13 deletions pkgs/shells/nushell/plugins/gstat.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,28 @@
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;
};
}
})
24 changes: 10 additions & 14 deletions pkgs/shells/nushell/plugins/highlight.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,32 @@
fetchFromGitHub,
}:

rustPlatform.buildRustPackage rec {
pname = "nushell_plugin_highlight";
rustPlatform.buildRustPackage (finalAttrs: {
pname = "nu_plugin_highlight";
version = "1.4.5+0.104.0";

src = fetchFromGitHub {
repo = "nu-plugin-highlight";
owner = "cptpiepmatz";
rev = "refs/tags/v${version}";
repo = "nu-plugin-highlight";
tag = "v${finalAttrs.version}";
hash = "sha256-B2CkdftlxczA6KHJsNmbPH7Grzq4MG7r6CRMvVTMkzQ=";
fetchSubmodules = true;
};

useFetchCargoVendor = true;
cargoHash = "sha256-3bLATtK9r4iVpxdbg5eCvzeGpIqWMl/GTDGCORuQfgY=";

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 ];
};
}
})
5 changes: 4 additions & 1 deletion pkgs/shells/nushell/plugins/net.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}:

rustPlatform.buildRustPackage rec {
pname = "nushell_plugin_net";
pname = "nu_plugin_net";
version = "1.10.0";

src = fetchFromGitHub {
Expand All @@ -21,6 +21,9 @@ rustPlatform.buildRustPackage rec {

nativeBuildInputs = [ rustPlatform.bindgenHook ];

# there are no tests
doCheck = false;

passthru.updateScript = nix-update-script { };

meta = with lib; {
Expand Down
28 changes: 12 additions & 16 deletions pkgs/shells/nushell/plugins/polars.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,29 @@
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 ];
};
}
})
15 changes: 5 additions & 10 deletions pkgs/shells/nushell/plugins/query.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@
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.
Expand All @@ -33,12 +29,11 @@ rustPlatform.buildRustPackage rec {
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;
};
}
})
Loading
Loading