New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
programs.neovim: init #98506
programs.neovim: init #98506
Conversation
I worry a bit about adding yet another dimension to the "how have you set up your neovim configuration in nix(os)". Could you expand a bit on the motivation? I'm not entirely sure I understand it completely. Is this mainly about the ability of adding files to Besides that, having it documented in |
I think an editor would be best configured on a per-basis project too but right now that's too hard. The
I've been frustrated long enough with the nix vim configuration system and this is the smallest PR I could put that fixed it. I have tried to build the runtime in vim-utils but it was just too hard and not as powerful as the module system. I do plan to improve the vim-utils.nix file (I have some local changes too) but little by little. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I'll trust your judgement on the "why" then. Left some comments on the "what".
nixos/modules/programs/neovim.nix
Outdated
''; | ||
description = '' | ||
Generate your init file from your list of plugins and custom commands, | ||
and loads it from the store via <command>nvim -u /nix/store/hash-vimrc</command> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar seems off. Maybe "Generate your init file from your list of plugins and custom commands. neovim
will then be wrapped to add the -u /nix/store/hash-vimrc
flag." (or similar).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I got this, I updated the description though.
How does this relate with the |
7fc18b9
to
cad7250
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good to me now, except some minor formatting things. The question about the relation to home-manager still remains though. My worry is that we now have at least three (.override
, nixos-module, home-manager module) just-so-slightly different ways to configure neovim
. That might add to the confusion. What do you think? Maybe this should at least match the home-manager UX exactly, or we keep it in home-manager entirely and just suggest people to use that.
Allows to build a proper runtime folder with after/ ftplugin/ parser/ subfolders etc. (neo)vim expects a few different folders, for instance to load treesitter parsers. This PR reuses the builder from the etc module, notwithstanding the different modes/uid/gid. This allows to get rid of some autocmd in customRC (via proper use of the folder hierarchy) which is a win in my opinion.
cad7250
to
2902550
Compare
thanks for the reviews, I tried to address them. I used to be adamant about home-manager and nixos modules convergence but it's clear it's not happening anytime soon. Thus I don't think it's a problem if they diverge (I kinda keep an eye on both). My goal is to let the module remain a thin interface wrapper around better vim-utils.nix functions. Having a module in the same repository as the utilities makes the task easier IMO (and we may experiment a bit more in HM). |
Alright. I still think it would be desirable to match the HM and NixOS modules from an UX perspective (even if the implementation differs). I understand your point too though. Your call :) |
''; | ||
description = '' | ||
Generate your init file from your list of plugins and custom commands. | ||
Neovim will then be wrapped to load <command>nvim -u /nix/store/<hash>-vimrc</command> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
building '/nix/store/f49frvgmnk7j528awy3z45p36rc3rhcl-options-docbook.xml.drv'...
intermediate.xml:8247: parser error : Opening and ending tag mismatch: hash line 8247 and command
m will then be wrapped to load <command>nvim -u /nix/store/<hash>-vimrc</command
^
intermediate.xml:8248: parser error : Opening and ending tag mismatch: command line 8247 and para
</para></nixos:option-description><para><emphasis>Type:</emphasis> attribute set
^
intermediate.xml:8248: parser error : Opening and ending tag mismatch: para line 8247 and nixos:option-description
</para></nixos:option-description><para><emphasis>Type:</emphasis> attribute set
^
intermediate.xml:8267: parser error : Opening and ending tag mismatch: option-description line 8247 and listitem
</filename></member></simplelist></listitem></varlistentry><varliste
^
intermediate.xml:8267: parser error : Opening and ending tag mismatch: listitem line 8247 and varlistentry
</filename></member></simplelist></listitem></varlistentry><varliste
^
intermediate.xml:75124: parser error : Opening and ending tag mismatch: varlistentry line 8247 and variablelist
</filename></member></simplelist></listitem></varlistentry></variablelist>
^
intermediate.xml:75124: parser error : Opening and ending tag mismatch: variablelist line 8247 and appendix
lename></member></simplelist></listitem></varlistentry></variablelist></appendix
^
intermediate.xml:75126: parser error : EndTag: '</' not found
^
unable to parse intermediate.xml
This will probably block the unstable-small
channel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, it was already reverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a fork… github's UI is complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a fork for the revert/fix of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will commit a fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here #99023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajs124 does that fix it for you ? I dont have the resorces to build on master but it looked fine.
The defaultEditor option doesn't do anything and enabling this module unconditionally configures neovim as the default editor. Edit: this would be fixed by #101127 |
thanks for the notification, looking forward to #101127 |
configure = cfg.configure // { | ||
|
||
customRC = (cfg.configure.customRC or "") + '' | ||
set runtimepath^=${runtime}/etc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why this appends the /etc
and not just the runtime path?
Since, as far as I can tell, the runtime in the config attribute sets them directly in the path and not in etc. For example, for a tree-sitter parser need to put them in the etc/parser/foo.so
to make it work.
Allows to build a proper runtime folder with after/ ftplugin/ parser/ subfolders etc.
(neo)vim expects a few different folders, for instance to load
treesitter parsers.
This PR reuses the builder from the etc module, notwithstanding the
different modes/uid/gid.
This allows to get rid of some autocmd in customRC (via proper use of
the folder hierarchy) which is a win in my opinion.
Motivation for this change
I find strange to use a systemwide module for an editor but #55635 was too ambitious this I prefer to do it step by step. The (neo)vim configuration is not trivial and the module system with the typecheck is quite useful. The ability to reproduce a proper runtime folder is quite useful to alleviate the customrc writing but also to install treesitter parsers alongside neovim. I plan to improve the module later but right now I use it with
@timokau
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)