You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current way of generating these config files means that they will be re-generated on every start of Nushell, adding to the startup time and causing disk writes. As an improvement, I suggest running the file-creation command with nix (don't know enough about that to make a specific function suggestion).
The text was updated successfully, but these errors were encountered:
Nushell will automatically load any files in $XDG_DATA_DIRS/nushell/vendor/autoload, and NixOS automatically adds any place the user profile might be to XDG_DATA_DIRS. My personal config did this by disabling the default nushell integration for each of the modules I was using, and instead used pkgs.runCommand to generate the files at build time and put them into $out/share/nushell/vendor/autoload, and added the resulting derivations to home.packages.
This functionality was only added fairly recently in 0.96, so it's not too surprising that it wasn't used.
Starship:
home.packages=mkIfcfg.enableNushellIntegration[(pkgs.runCommand"starship-nushell"{}'' mkdir -p $out/share/nushell/vendor/autoload${lib.getExecfg.package} init nu > $out/share/nushell/vendor/autoload/starship.nu '')];
Style may differ though. I generally use lib.getExe and lib.singleton, though the existing modules don't seem to do that.
Note that an alternative would be to get upstream to add to the package's postInstall to write the files in their own paths, at which point they would be unconditionally enabled even without home-manager doing anything. I'm pretty sure fish has something similar, and the same is probably true for zsh. At that point though, why not just do it for every shell that supports vendor scripts and that each package supports?
Description
Currently, the Nushell integrations work by writing Nushell commands into the nushell env file:
"${config.xdg.cacheHome}/somepackage
directoryThe next step of the integration then writes a
source
command intoconfig.nu
that loads the file.for examples, see
The current way of generating these config files means that they will be re-generated on every start of Nushell, adding to the startup time and causing disk writes. As an improvement, I suggest running the file-creation command with nix (don't know enough about that to make a specific function suggestion).
The text was updated successfully, but these errors were encountered: