Can I override a package using its NixOS program module's options?

I want to override the neovim package, providing a value for the NixOS programs.neovim.configuration option when doing so.

I checked the source code for pkgs.neovim, and the NixOS program module options aren’t present.

Is it possible to use NixOS program options when overriding a package?

And out of curiousity, why given that these options are not present in the package itself.

Many thanks.

This is where the options are from:

I find it hard to understand what you’re attempting to achieve here and I smell an XY-problem. Could you describe what you’re trying to achieve here in more detail?

Please note that override options and NixOS options are entirely different things and don’t interact with another unless explicitly made to do so.

Yes, sorry, this is an XY. I am less concerned with how I override neovim’s options, than understanding why I can override the neovim package, with options from the neovim NixOS module posted above.

If I go to NixOS package search, and search neovim, and follow the source link, it takes me here:

The options present in the module that @mightyiam posted are not referenced in the source code at all. So I am confused that I am able to do the following (and for it to work) when configure is not an attribute in the neovim package. Where are full set of attributes for the neovim package defined if not in the source file?

 pkgs.neovim.override {
    configure = {
      packages.all.start = plugins;
      customRC = customRC;
    };

That link is actually to neovim-unwrapped.
neovim is located at nixpkgs/pkgs/applications/editors/neovim/wrapper.nix at 797f7dc49e0bc7fab4b57c021cdf68f595e47841 · NixOS/nixpkgs · GitHub

The meta.position for neovim was fixed on unstable in wrapNeovimUnstable: fix meta.position by eclairevoyant · Pull Request #334036 · NixOS/nixpkgs · GitHub but it wasn’t backported to stable.

2 Likes

@waffle8946 Thank you for clearing up my confusion!