Skip to content
Closed
Show file tree
Hide file tree
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
75 changes: 75 additions & 0 deletions pkgs/shells/nushell/plugins/bash-env.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
stdenv,
lib,
rustPlatform,
fetchFromGitHub,
unstableGitUpdater,
makeWrapper,
resholve,
nushell,
bash,
jq,
coreutils,
IOKit,
Foundation,
}:
rustPlatform.buildRustPackage {
pname = "nu-plugin-bash-env";
version = "0.13.0";

src = fetchFromGitHub {
owner = "tesujimath";
repo = "nu_plugin_bash_env";
rev = "0.13.0";
hash = "sha256-fWFBGeNqrJj+fT8EusS8VhxoCmncqhQUplPEHOJlqRA=";
};

cargoHash = "sha256-z5pl1QjNLldXuj2ZWPlMEr/IeR9Fx73ZYDisIhEFxnY=";
passthru.updateScript = unstableGitUpdater { };

buildInputs = lib.optionals stdenv.isDarwin [
IOKit
Foundation
];
Comment on lines +30 to +33
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is needed as I don't own a Mac, just copied this from the other plugins.


nativeBuildInputs = [ makeWrapper ];

postInstall = ''
install -Dm755 $src/scripts/bash_env.sh $out/libexec/bash_env
'';

postFixup = ''
${resholve.phraseSolution "bash_env" {
scripts = [ "libexec/bash_env" ];
interpreter = "${bash}/bin/bash";
inputs = [
jq
coreutils
];
keep = {
"source" = [ "$_path" ];
};
}}
Comment on lines +42 to +52
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrapping this with PATH would pollute its output, so using resholve instead.

wrapProgram $out/bin/nu_plugin_bash_env \
--set NU_PLUGIN_BASH_ENV_SCRIPT $out/libexec/bash_env
'';

doInstallCheck = true;
installCheckPhase = ''
${nushell}/bin/nu -c "
plugin add --plugin-config /tmp/plugins.msgpackz $out/bin/nu_plugin_bash_env
"
${nushell}/bin/nu -c "
plugin use --plugin-config /tmp/plugins.msgpackz bash_env
use $src/tests.nu run_bash_env_tests
run_bash_env_tests
"
'';

meta = {
description = "A Bash environment plugin for Nushell";
homepage = "https://github.com/tesujimath/nu_plugin_bash_env";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.misterio77 ];
};
}
1 change: 1 addition & 0 deletions pkgs/shells/nushell/plugins/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib, newScope, IOKit, CoreFoundation, Foundation, Security }:

lib.makeScope newScope (self: with self; {
bash_env = callPackage ./bash-env.nix { inherit IOKit Foundation; };
gstat = callPackage ./gstat.nix { inherit Security; };
formats = callPackage ./formats.nix { inherit IOKit Foundation; };
polars = callPackage ./polars.nix { inherit IOKit Foundation; };
Expand Down