nixvim icon indicating copy to clipboard operation
nixvim copied to clipboard

[BUG] docs wrongly claim `helpers` is accessible anywhere

Open MattSturgeon opened this issue 11 months ago • 7 comments

Field Description
Plugin N/A
Nixpkgs unstable
Home Manager unstable

  • [x] I have read the FAQ and my bug is not listed there.

Description

The docs state that I should be able to access the helpers attribute as a module parameter, however nix flake check states it is missing.

Minimal, Reproducible Example (MRE)

Not very minimal I'm afraid, but this branch demonstrates the issue when running nix flake check .

(I'll try and make a proper MRE if this proves necessary)

Speculation

My first thought was this is flake related, however I would have expected this to have come up already if so. My next guess is is could be related to the way I add my flake inputs to the nixos/home-manager extraArgs?

MattSturgeon avatar Mar 06 '24 19:03 MattSturgeon

Also unable to access any helpers attribute.

purepani avatar Mar 11 '24 14:03 purepani

It is present on config.nixvim.helpers. See here.

robhanlon22 avatar Mar 11 '24 22:03 robhanlon22

I suspect this is happening because I import the NixVim home-manager module from within my module;

If NixVim is using _module.args to add helpers to the module args, then I believe that will only affect modules on the same "import level", for lack of a better term.

As an aside, personally I'd rather access helper libs via a lib flake output. I'm not massively keen on third-party modules cluttering up my module args...

It is present on config.nixvim.helpers

Thanks, that's a useful workaround.

MattSturgeon avatar Mar 13 '24 00:03 MattSturgeon

lib is also available as a flake output, I used to use it myself: https://github.com/nix-community/nixvim/blob/main/flake-modules/lib.nix

robhanlon22 avatar Mar 20 '24 01:03 robhanlon22

I've updated the title because I believe this is mostly a documentation issue, rather than an implementation bug.

Perhaps, instead of claiming we can use helpers anywhere, the flake output and config attribute should also be mentioned.

Maybe there is also a good way to explain where _module.args has any effect?

MattSturgeon avatar Mar 29 '24 04:03 MattSturgeon

I think this used to be true, but due to some refactoring of the helpers it is now broken. I need to look into it but I never find the time...

traxys avatar Mar 29 '24 09:03 traxys

It is definitely true that this works for standalone nixvim, but I kind of agree that we should not do it for NixOS and Home-Manager because it could conflict with a user defined extraArg

traxys avatar Mar 29 '24 09:03 traxys