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 regular nix
flakes and with devenv
.
- the flake itself (or
lib.nushellWith
): a function that takes a description of a nushell configuration (which libraries, plugins andconfig.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 (frompkgs.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 withflake = 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 thelibraries.source
argument ofnushellWith
packages.<system>
: a set of pre-packaged nushell libraries and plugins (see below)
This flake also provides as Nix derivations some nushell libraries and plugins
published on Github, so you don't have to write nix derivations for them and
deal with their own dependencies. PRs to add new things to this
list are very much welcome. Don't forget to add the
URL of the library/plugin (and also of its external dependencies if it has any)
to the inputs
of the main flake.nix
.
The nix attribute names of the provided plugins should be of the form plugin-*
to tell plugins and libraries apart.
- Only plugins written in Rust can be passed to
plugins.source
, and they will be built bycrane
.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 bynushellWith
. - Using
plugins.source
withdevenv
only works withdevenv >= v1.1
.