Skip to content

YPares/nushellWith

Repository files navigation

built with garnix

nushellWith

Build an isolated nushell environment with a specific set of plugins (from either nixpkgs or built from source) and nu libraries (from source).

See the examples folder for how to use it. Examples show usage with a regular nix flake.

Outputs of this flake

  • the flake itself (or lib.nushellWith): a function that takes a description of a nushell configuration (which libraries, plugins and config.nu & env.nu files to use) and outputs a nushell wrapper. This nushell wrapper derivation also has the following attributes:
    • plugins-env: a nix env (from pkgs.buildEnv) containing symlinks to all the wanted plugins. This can be useful if you want a set of plugins grouped together in one place.
  • lib.makeNuLibrary: a function that takes a nushell library as a folder (e.g. obtained from github via one of your flake inputs flagged with flake = false;) and patches it to add some binary dependencies to its path when it is imported. It outputs the resulting patched folder as a derivation, ready to be passed to the libraries.source argument of nushellWith. See my monurepo repository as an example of how external repositories can packages Nu libraries with it
  • packages.<system>: a set of pre-packaged nushell libraries and plugins (see below)

Pre-packaged nushell libraries & plugins

This flake also provides as Nix derivations some nushell libraries and plugins, so you don't have to write nix derivations for them and deal with their own dependencies. All plugins from crates.io (ie. every crate named nu_plugin_*) are procedurally packaged, but their system dependencies have to be added on a case-by-case fashion. Besides, plugins are tested to check that they can be loaded with the latest Nushell version (notably, some may build successfully but not be usable because they use too old a version of the nu-plugin or nu-protocol crates).

See the garnix build results to know which plugins failed to build or load, and this list from awesome-nu to check which plugins are based on an up-to-date version of the nu crates.

PRs to add new entries to the list of packaged libraries & plugins are very much welcome.

Limitations & important notes

Only plugins written in Rust can be passed to plugins.source, and they will be built by crane. plugins.nix on the other hand accepts any derivation that builds a proper plugin, ie. that builds a $out/bin/nu_plugin_* executable which implements the nu-plugin protocol. In both cases, the plugin executable is automatically discovered by nushellWith.

About

Isolated nushell envs with specific plugins and libraries (with Nix)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages