Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions pkgs/shells/nushell/plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,47 @@
lib,
config,
newScope,
dbus,
versionCheckHook,
nushell,
runCommand,
nushell,
testers,
dbus,
}:

lib.makeScope newScope (
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 ];
_n: package:

passthru.tests.loadCheck =
# add two checks:
# - 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.
# - `versionCheck`, checks wether it's a binary that is able to
# display its own version. Suffix `-unstable-*` is ignored.
package.overrideAttrs (
final: _prev: {
passthru.tests = {
loadCheck =
let
nu = lib.getExe nushell;
plugin = lib.getExe withChecks;
plugin = lib.getExe package;
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
versionCheck = testers.testVersion {
inherit package;
command = "${lib.getExe package} --help";
version = lib.head (lib.splitString "-unstable" final.version);
};
};
}
)
)
(
with self;
Expand Down