Not a direct answer to your question, but this made me think of this post:
Back to topic:
Would something like this help you?
This is a simple nvim config built using nixvim
(which I actually never used ^^ but it’s good for minimal setups)
Put the following in somefile.nix
:
let
# The following get's a nixpkgs & nixvim version, included as is to make this example simple & self-contained.
# In reality you should use a pinning helper like npins (https://github.com/andir/npins).
nixpkgs = import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/nixos-24.11.tar.gz";
sha256 = "sha256:1cvxfj03xhakyrrz8bh4499vz5d35ay92575irrbmydcxixsrf3w";
}) {};
nixvim = nixpkgs.fetchFromGitHub {
owner = "nix-community";
repo = "nixvim";
rev = "nixos-24.11"; # must be compatible with nixpkgs
hash = "sha256-MpLljx/1dGnBIQlUswaUz/ZeOp44R3ngc1iBf4tyzyc=";
};
makeNixvim = (import nixvim).outputs.legacyPackages.${builtins.currentSystem}.makeNixvim;
nvim = makeNixvim {
colorschemes.gruvbox.enable = true;
};
in {
inherit nvim;
}
And run it with nix run -f somefile.nix nvim
Note that in this case the parameter named nvim
is important for nix run ..
to use the correct nvim
binary from the built derivation in nvim
attribute.
Alternatively you can put that nvim
‘variable’ in your NixOS
’s environment.systemPackages
(it’s a full nvim packages with a nvim
bin)