kind of reminds me of etc in NixOS but expanded to any file.
Yes but also with impurity! ![]()
With good reason, it’s outside of what you’ll find in nixos / nixpkgs, as it loses reproducibility guarantees, in exchange for iteration speed.
I would recommend also checking out mnw. It provides a devMode, which lets you apply Lua config immediately while in the devshell. The only time you have to actually build is when you add a new plugin/binary to the closure. I use it personally, and have had a great experience with it.
… and then today I realized that if I’m managing not only my personal systems with full nix config repo checkouts, but also servers and nucs and whatnot that only get nixos-rebuild --target-host deploys, I would prefer the full wrapper including -u {init.lua} (ending back at @fzakaria 's post)
So I added an initLuaFile option that does exactly that. Basically extending @viperML 's neovim wrapper from scratch to make that part optional.
I only skimmed through the repo, so I couldn’t find if their impl is radically different, but I essentially do the same thing.
The builder function takes a flag that will make it inject a init.lua shim instead of the actual code from flake; the shim uses nvim’s api to find the config’s root and adds it to runtimepath, package.path, etc., and then dofiles the actual init.lua.
I’ve also written a small lua lib that allows me to filter and set rtp/pp/package.path. It’s used by the flake to remove any impure paths, excluding stdpath("data"), since it’s used for a local state and so on.
You just need to rerun the devshell when changing plugins (and if you use direnv, it does that for you).
The nix code is not super pretty because it’s a homegrown mutilation of kickstart-nix, but hey it works lol.
(Also now that I’m writing this I realize I also need to filter package.cpath.)