modules: add helper scripts (#346)

* modules: add helpers to display init.lua and its store path

* docs: update 0.7 release notes

* modules: use writeDashBin for helpers
This commit is contained in:
raf 2024-07-20 13:01:40 +00:00 committed by GitHub
parent f9789432f9
commit 8b15271f63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 2 deletions

View file

@ -141,3 +141,11 @@ configuration formats.
- Add [neo-tree.nvim] as an alternative file-tree plugin. It will be available - Add [neo-tree.nvim] as an alternative file-tree plugin. It will be available
under `vim.filetree.neo-tree`, similar to nvimtree. under `vim.filetree.neo-tree`, similar to nvimtree.
- Add `print-nvf-config` & `print-nvf-config-path` helper scripts to Neovim
closure. Both of those scripts have been automatically added to your PATH upon
using neovimConfig or `programs.nvf.enable`.
- `print-nvf-config` will display your `init.lua`, in full.
- `print-nvf-config-path` will display the path to _a clone_ of your
`init.lua`. This is not the path used by the Neovim wrapper, but an
identical clone.

View file

@ -105,10 +105,30 @@ inputs: {
inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3; inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3;
inherit extraLuaPackages extraPython3Packages; inherit extraLuaPackages extraPython3Packages;
}; };
# Additional helper scripts for printing and displaying nvf configuration
# in your commandline.
printConfig = pkgs.writers.writeDashBin "print-nvf-config" ''
cat << EOF
${vimOptions.builtLuaConfigRC}
EOF
'';
printConfigPath = pkgs.writers.writeDashBin "print-nvf-config-path" ''
realpath ${pkgs.writeTextFile {
name = "nvf-init.lua";
text = vimOptions.builtLuaConfigRC;
}}
'';
in { in {
inherit (module) options config; inherit (module) options config;
inherit (module._module.args) pkgs; inherit (module._module.args) pkgs;
# expose wrapped neovim-package # Expose wrapped neovim-package for userspace
neovim = neovim-wrapped; # or module consumption.
neovim = pkgs.symlinkJoin {
name = "nvf-with-helpers";
paths = [neovim-wrapped printConfig printConfigPath];
postBuild = "echo helpers added";
};
} }