nixvim
nixvim copied to clipboard
modules/output: cleanup + refactoring
Summary
General cleanup and refactoring to the output module, with the goal of streamlining and simplifying the implementation.
For example, the files submodule has path and plugin options that are essentially the same as extraFiles' target and the top-level's initPath options respectively.
As another example, the content option is currently read-only, meaning we cannot reflect the entire config file content there when we add neovimConfig.neovimRcContent to it.
Being able to do this also means the common (non top-level) modules can handle writing the config file, reducing the complexity in both the files submodule and the top-level output module.
As the changes in this PR are fairly broad, I also added some comments and inlined some sections of the top-level output module. IMO this makes it much easier to understand.
Generalising many of these output options allows for other changes like enabling type="vim" at the top-level (if users configure target="init.vim")
I did make the type option read-only, since it didn't make sense to me for it to default to the target's extension otherwise. But I'm unsure if this is a good change.
Draft
This is a draft because it's currently difficult to test; #1878
It also feels kinda broad, maybe it could be split up into smaller PRs? This is difficult since all the changes touch the same code...
I'd still appreciate feedback on the overall direction, style, changes while we wait for buildbot to work again.
pkgs.wrapNeovimUnstable lua support
While nixpkgs added luaRC support recently, I don't think we can take advantage of that for two reasons:
- the wrapper function expects the string content
- the wrapper will want to write the init file(s) itself
- the wrapper may not order the rc sections the way we would like
- the wrapper can't implement
wrapRcthe way we would like
Related work
It'd be nice to make "standalone" builds less special; I think we can achieve that by adding a standalonePackage option, similar to finalPackage.
I think the "disabling env config" is somewhat unrelated to wrapRc, so perhaps that should have its own option?
I don't think we need wrapRc = mkForce true in the nixos wrapper, other than to ensure /etc is used instead of ~/.config.
Removing "site" from the rtp could also conflict with treesitter (#1855).
Changes when opening PR
- modules/output: rename
path->target - modules/output: introduce
finalConfigoption - modules/output: override
contentin top-level - modules/output: cleanup top-level
- modules/output: make
contenttypelines - lib/utils: move
hasContentto helpers lib - modules/output: only print relevant parts of config
- modules/output: allow lua or vim init files
- modules/output: make
typeoption readOnly