mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-11 18:32:23 +08:00
nushellPlugins.*: add load check to all
(cherry picked from commit 4e681f2a04)
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
{
|
||||
stdenv,
|
||||
runCommand,
|
||||
lib,
|
||||
rustPlatform,
|
||||
pkg-config,
|
||||
nix-update-script,
|
||||
fetchFromGitHub,
|
||||
dbus,
|
||||
nushell,
|
||||
nushell_plugin_dbus,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
@@ -27,19 +24,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
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 "${finalAttrs.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 = {
|
||||
description = "Nushell plugin for communicating with D-Bus";
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
newScope,
|
||||
dbus,
|
||||
versionCheckHook,
|
||||
nushell,
|
||||
runCommand,
|
||||
}:
|
||||
|
||||
lib.makeScope newScope (
|
||||
@@ -12,10 +14,33 @@ lib.makeScope newScope (
|
||||
lib.mapAttrs
|
||||
(
|
||||
_n: p:
|
||||
p.overrideAttrs {
|
||||
doInstallCheck = true;
|
||||
nativeInstallCheckInputs = [ versionCheckHook ];
|
||||
}
|
||||
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;
|
||||
@@ -29,7 +54,6 @@ lib.makeScope newScope (
|
||||
highlight = callPackage ./highlight.nix { };
|
||||
dbus = callPackage ./dbus.nix {
|
||||
inherit dbus;
|
||||
nushell_plugin_dbus = self.dbus;
|
||||
};
|
||||
skim = callPackage ./skim.nix { };
|
||||
semver = callPackage ./semver.nix { };
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
{
|
||||
stdenv,
|
||||
runCommand,
|
||||
lib,
|
||||
rustPlatform,
|
||||
nix-update-script,
|
||||
fetchFromGitHub,
|
||||
nushell,
|
||||
skim,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
@@ -24,19 +21,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
|
||||
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 "${finalAttrs.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 = {
|
||||
description = "A nushell plugin that adds integrates the skim fuzzy finder";
|
||||
|
||||
Reference in New Issue
Block a user