Background: I wanna to create a neovim flake with all vim/nvim plugins + some pre-built binaries like clangd & treesitter. And use it on every x86/aarch64 with some linux distro with or without internet.
Already try:
nix bundle: too slow to open neovim.
nix copy: can copy the closure, can run the neovim binary directly, like /nix/store/xxxxxx-neovim/bin/nvim some-file.py. But I can not invoke it via with nix cmd, e.g. nix run .#nvim, then I can’t make any changes/debug the lua configuration within the flake, also, I can’t invoke pre-built binary installed by the flake directly, like fzf, as it somehow needs internet connection to download some nixpkg stuff.
Any better methods that could deal with my situation?
You can use Lua still with NixVim, I have a line like extraConfigLua = builtins.readFile ./config.lua; so I can load in Lua code.
Unfortunately, I don’t have any suggestions regarding making a better “offline” bundle. I read this thread already and I think unfortunately you’ve tried everything I would’ve suggested.
I’m not entirely sure what you mean by offline usage, but if you want to use it on a distro other that NixOS it will remain available as long as it’s installed on your profile or by using home-manager for example. NixVim is a fantastic project but I also didn’t want to configure neovim using nix, I use it just as a package manager so I can edit the lua config without nix interaction.
There are a lot of “neovim as a flake” configurations out there, here’s mine GitHub - aorith/neovim-flake: Neovim configuration using a nix flake, the readme explains the structure a bit. I use the package “nvim-without-config” that doesn’t bundle the lua config in the nix store.