nixCats-nvim icon indicating copy to clipboard operation
nixCats-nvim copied to clipboard

docs failed (LazyVim template)

Open datacurse opened this issue 9 months ago • 33 comments

Hello! Installed LazyVim template on nixos, using as flake. Lazy shows several errors regarding docs installation. I assume its something trivial but i have no experience in both nixos and nvim T~T

Image

datacurse avatar Mar 23 '25 15:03 datacurse

Hmmmm

So, those files are in the store. lazy.nvim can't write to them

If you want the tags to generate you will have to install them via lazy.nvim instead...

I am exploring the options lazy.nvim has right now to see if there is a way to get it to generate to somewhere else?

To be honest, I don't use lazy.nvim. I didn't think of this.

I wonder if this is a thing we could look at doing in nixpkgs one day so that all nvim plugins from nix have this feature?

you can look at the readmes in the store with lua vim.cmd.edit(nixCats.pawsible("allPlugins.start.pluginname") .. "/README.md") but I understand thats not quite the same.

BirdeeHub avatar Mar 23 '25 16:03 BirdeeHub

Generally I try to steer people towards making their own configurations using lze or lz.n for lazy loading like the example template.

The readme for the LazyVim template was really bad and failed at that goal.

However I would also like to go through soon and improve the LazyVim template in general.

BirdeeHub avatar Mar 23 '25 16:03 BirdeeHub

@BirdeeHub

id like to do it the way you suggest ^^ which cats template would you recommend to use?

datacurse avatar Mar 23 '25 16:03 datacurse

https://github.com/BirdeeHub/nixCats-nvim/tree/main/templates/example

This is the main example template.

Leave this issue open though I would like to see if I can solve the docs thing, and maybe add some extra categories for the worst offenders of the extras such as these ones.

Or at least have people be more aware of the limitations of using LazyVim on nix.

BirdeeHub avatar Mar 23 '25 16:03 BirdeeHub

So, yeah LazyVim template, despite being not the suggested method, is also a little subpar right now. The kickstart one that also uses lazy.nvim works much better than the LazyVim one and I would like to make it at least closer to that.

But yeah using lazy on nix just adds extra layers in between you and actually configuring the thing unless you are actually using lazy.nvim to download the stuff (and honestly, even then)

BirdeeHub avatar Mar 23 '25 16:03 BirdeeHub

can you please show your config? 00

datacurse avatar Mar 23 '25 16:03 datacurse

https://github.com/BirdeeHub/nixCats-nvim/discussions/105

Mines a mess but I put it here.

I used to have it in my main config repo but I moved it into a separate flake again so I could link it and not confuse XD

BirdeeHub avatar Mar 23 '25 16:03 BirdeeHub

im all for minimizing abstractions, i cant keep too many things in my small head

datacurse avatar Mar 23 '25 16:03 datacurse

#105

Mines a mess but I put it here.

I used to have it in my main config repo but I moved it into a separate flake again so I could link it and not confuse XD

thanks, i will cannibalize it :3

datacurse avatar Mar 23 '25 16:03 datacurse

do i understand right that it will work even without nix? as in, ill be able to clone it to .config/nvim on my rpi 5

or could i just install nix package manager on rpi as well? not sure how it works

datacurse avatar Mar 23 '25 16:03 datacurse

Well, not my personal one no. My personal one requires nix.

It could Im just lazy and dont need it.

The example config will though, it can just be cloned to ~/.config/nvim even without nix. Although mason may fail sometimes depending on OS and what dependencies you have or not.

BirdeeHub avatar Mar 23 '25 16:03 BirdeeHub

Its a nix config framework, if you arent using nix then the example one falls back to downloading the plugins via paq and the lsps via mason, which it can do because it has a normal directory structure, but you do have to put the urls in there for paq and Im too lazy to do that in my personal config.

All I would need to do is make a file with some urls in it though so if I need to for some reason I will. But yeah, I only use nix for it.

BirdeeHub avatar Mar 23 '25 17:03 BirdeeHub

honestly, for things like that, I personally would pass the resulting drv to pkgs.dockerTools or nix-appimage to make a thing I can copy onto stuff, rather than define downloads for paq. (docker produces smaller images but requires docker)

It has a lot less error rate than mason (with mason failing pretty much every time on the first go because I forgot rust yet again)

But usually I can install nix onto whatever it is

and then I can just nix run github:BirdeeHub/nixCats-nvim?dir=templates/example or install it in home manager or nix profile install it temporarily

Its only truly dire situations where using paq as backup is required.

I typically avoid not using nix because, honestly, so much trial and error installing an nvim config on a machine. Always some sort of dependency I forgot that I needed but cant install via mason or whatnot.

BirdeeHub avatar Mar 23 '25 17:03 BirdeeHub

sadly it seems that rpi 5 does not support nix yet

datacurse avatar Mar 23 '25 17:03 datacurse

awww

ok, well, appimage, docker, or keep the list of urls up to date for paq are the options there then

The list of urls being mentioned:

https://github.com/BirdeeHub/nixCats-nvim/blob/main/templates/example/lua/myLuaConf/non_nix_download.lua

BirdeeHub avatar Mar 23 '25 17:03 BirdeeHub

ig ill go with the simplest one, which seems to be paq

datacurse avatar Mar 23 '25 17:03 datacurse

honestly, the appimage and docker are not that complex either

you just pass the config to the bundler function at the end

here is me doing it with nix-appimage

https://github.com/BirdeeHub/birdeevim/blob/bc9213c6f1d346b9da1942aecddd77f3b6d32f76/flake.nix#L92-L94

Then you just nix build that output and copy it (mine is way too big tho... multiple GB... I keep meaning to refactor my config and make good use of my categories but never do because im too busy doing other stuff XD also docker images are notably smaller)

The one from the example template is small enough to be buildable in a github release via action though

BirdeeHub avatar Mar 23 '25 17:03 BirdeeHub

https://github.com/BirdeeHub/nixCats-nvim/blob/main/templates/example/lua/myLuaConf/non_nix_download.lua

and here would be paq.

BirdeeHub avatar Mar 23 '25 17:03 BirdeeHub

the mason stuff is all handled in the LSPs/init.lua in the example config along with the rest of the lsp stuff

BirdeeHub avatar Mar 23 '25 17:03 BirdeeHub

Im going to work next on improving the LazyVim template though because I made the regrettable decision of adding it in the first place XD So I suppose my personal config refactor will have to wait for longer XD

BirdeeHub avatar Mar 23 '25 17:03 BirdeeHub

But yeah the errors were because you tried to update them via lazy when lazy wasnt what installed them basically

BirdeeHub avatar Mar 23 '25 17:03 BirdeeHub

it seems that i was wrong and nixos can actually work on rpi 5 (the repo was archived today for some reason which spooks me out)

https://github.com/nix-community/raspberry-pi-nix

datacurse avatar Mar 23 '25 17:03 datacurse

Im going to work next on improving the LazyVim template though because I made the regrettable decision of adding it in the first place XD So I suppose my personal config refactor will have to wait for longer XD

thats a wide pipeline entrance into nixCats. just wait for Vimjoyer to post a video or something haha

datacurse avatar Mar 23 '25 17:03 datacurse

Hopefully!

But yeah right now, I have until core neovim starts working on remote plugin hosts to work on fixing this ill-advised template. Thats the only thing coming up (in 0.12, so a while from now) that forces me to change anything in the core of nixCats. So until then, templates and help.

(seriously why did I do lazyvim to myself... I dont even like the config it gives XD but, ehh, it doesnt change that often, should be fine, maybe I learn some tricks for getting some random languages working nicely along the way)

BirdeeHub avatar Mar 23 '25 18:03 BirdeeHub

it seems that i was wrong and nixos can actually work on rpi 5 (the repo was archived today for some reason which spooks me out)

https://github.com/nix-community/raspberry-pi-nix

also, it doesnt need nixos, just nix itself

BirdeeHub avatar Mar 23 '25 18:03 BirdeeHub

and it makes a ton of sense that it would run on rpi actually, robotics engineers like both nix and rpi

It being achived is a bit odd, did support get fully upstreamed or something?

BirdeeHub avatar Mar 23 '25 18:03 BirdeeHub

and it makes a ton of sense that it would run on rpi actually, robotics engineers like both nix and rpi

It being achived is a bit odd, did support get fully upstreamed or something?

i have no idea what happened, it seemed to be very active and had recent changes and then boom, archived.

datacurse avatar Mar 23 '25 20:03 datacurse

Hi thanks for nixCats, it is a great project and I can see you provide great support here! 🙏

But yeah the errors were because you tried to update them via lazy when lazy wasnt what installed them basically

I just recently installed nixCats, and I decided to transition away from lazy.nvim gradually, so I used the kickstart config as the basis of my config.

I am getting the same error reported by the OP:

  Failed (2)
    ● noice.nvim 1.06ms 󰢱 telescope._extensions.noice  telescope.nvim
        ...hare/nvim/lazy/lazy.nvim/lua/lazy/manage/task/plugin.lua:95: Vim:E152: Cannot open /nix/store/0nbzjsbas7zmxbzqgdfxb9d5bkinf4gp-vim-pack-dir/pack/myNeovimPackages/start/noice.nvim/doc/tags for writing
    ● telescope.nvim 39.29ms  start
        ...hare/nvim/lazy/lazy.nvim/lua/lazy/manage/task/plugin.lua:95: Vim:E152: Cannot open /nix/store/0nbzjsbas7zmxbzqgdfxb9d5bkinf4gp-vim-pack-dir/pack/myNeovimPackages/start/telescope.nvim/doc/tags for writing

I don't understand why the tags are not being installed via nix also. I guess a different mechanism is used to install them...

If there is no way to fix this problem in my current setup, then I may consider getting rid of lazy.nvim entirely. But if I do this, will nix then be able to install the help tags? 🤔

Kind regards, Mettavi.

mettavi avatar Sep 20 '25 07:09 mettavi

For now, the best I have for you is to tell you to put readme.enable = false in your lazy.nvim config's options table. (or install plugins without docs via lazy instead I guess)

Nix does in fact generate tags if they weren't present, which gets ran via buildVimPlugin, however it does not do so for markdown files unfortunately.

Lazy.nvim does allow you to change what directory it puts the generated md files with taggable headings it can make, but unfortunately, it does NOT allow you to choose where it puts the tags themselves, and puts them into the plugins themselves (which are in the store, hence the error).

I think there may be some workaround, but I haven't found time to look for it, and I could suggest a patch to lazy.nvim but folke has been AFK so I haven't really looked into that option.

What would be pretty cool would be if someone made another hook for generating them from markdown files like the existing hook and added it alongside the other one or at the very least told me about it so I could add it to the one nixCats uses for its mkPlugin function and auto plugin overlay (although, adding it to buildVimPlugin would be better). I would be interested in doing that at some point maybe but I do not really have the time or motivation right now. When my most recent project (3-4 week old actually fast lua toml parser in the style of cjson) is further along, I will revisit that if no one else has, and see what kind of solution may be best to handle that. Hopefully nixpkgs would accept something like a doc tag hook like that, that would be the best outcome.

BirdeeHub avatar Sep 20 '25 08:09 BirdeeHub

For now, the best I have for you is to tell you to put readme.enable = false in your lazy.nvim config's options table

Thanks, I am happy to use this workaround; however, after adding the following to my init.lua for lazy.nvim:

  -- lazy can generate helptags from the headings in markdown readme files,
  -- so :help works even for plugins that don't have vim docs.
  -- when the readme opens with :help it will be correctly displayed as markdown
  readme = {
    -- nix is unable to generate helptags for md files and lazy cannot write them to the nix store, so disable this option
    -- see https://github.com/BirdeeHub/nixCats-nvim/issues/158 for details
    enabled = false,
    root = vim.fn.stdpath("state") .. "/lazy/readme",
    files = { "README.md", "lua/**/README.md" },
    -- only generate markdown helptags for plugins that don't have docs
    skip_if_doc_exists = true,
  },

I am still getting the same error:

Failed (2)
    ● noice.nvim 1ms 󰢱 telescope._extensions.noice  telescope.nvim
        ...hare/nvim/lazy/lazy.nvim/lua/lazy/manage/task/plugin.lua:95: Vim:E152: Cannot open /nix/store/azrmc1wxsz853qyh9l1cfww33agv64x9-vim-pack-dir/pack/myNeovimPackages/start/noice.nvim/doc/tags for writing
    ● telescope.nvim 88.26ms  start
        ...hare/nvim/lazy/lazy.nvim/lua/lazy/manage/task/plugin.lua:95: Vim:E152: Cannot open /nix/store/azrmc1wxsz853qyh9l1cfww33agv64x9-vim-pack-dir/pack/myNeovimPackages/start/telescope.nvim/doc/tags for writing

I am not sure why this is not working. 🤔

PS I realise this may be an issue with lazy.nvim and not nixCats!

mettavi avatar Sep 25 '25 09:09 mettavi