Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nushellPlugins.bash_env: init at 0.13.0 #343036

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Misterio77
Copy link
Member

Description of changes

Add nu_plugin_bash_env, a plugin that helps with sourcing bash environment files.

This should help with nix-community/home-manager#4313.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Comment on lines +42 to +52
${resholve.phraseSolution "bash_env" {
scripts = [ "libexec/bash_env" ];
interpreter = "${bash}/bin/bash";
inputs = [
jq
coreutils
];
keep = {
"source" = [ "$_path" ];
};
}}
Copy link
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.

Comment on lines +30 to +33
buildInputs = lib.optionals stdenv.isDarwin [
IOKit
Foundation
];
Copy link
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.

@fehnomenal
Copy link
Contributor

Thank you for your work. It would be nice to get this PR merged. Btw, there is already version 0.14.1 released.

@Misterio77
Copy link
Member Author

Nice! I'll update this in a couple of hours with the newer version

@jaredmontoya
Copy link
Contributor

jaredmontoya commented Nov 17, 2024

@Misterio77 judging from the README.md at https://github.com/tesujimath/bash-env-nushell the plugin is deprecated in favor of the nu "module" that is for now provided in the same repo as the plugin.

So technically it took long enough for a PR for a package to get merged into nixpkgs that the program that the package was made for got deprecated before the PR was merged which is funny in my opinion.

Using the module is as simple as use /path/to/bash-env.nu and it is only 38 lines of nu code which makes it work with any nu version.
But it requires bash-env-json to be in the path. So I will create a package for it.

@jaredmontoya
Copy link
Contributor

jaredmontoya commented Nov 22, 2024

I submitted a PR for the bash-env-json package #358140

Once merged it can be used with the bash-env-nushell (module) to implement a programs.nushell NixOS module.

0.9.1 can't process files that set PATH to something that has no required binaries. But it will work on files like /etc/profiles/per-user/nix/etc/profile.d/hm-session-vars.sh so home-manager can start implementing nushell support with 0.9.1

0.9.2 is coming soon with a fix: #358950

After that a nushell NixOS module will also be possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants