Project-specific neovim configuration

Currently, I manage my neovim configuration using home-manager. When developing some projects I wish to add extra configuration to neovim when entering the nix-shell so I decided to implement some helper functions. Now I need some help. What I want to achieve is that when I open neovim, it will:

  1. Apply all the global configurations.
  2. Source a project-specific init.vim.
  3. Add extra plugins to the runtimepath

In normal cases, it could be achieved by alias vi=vi -c "source /path/to/init.vim". The problem is how to configure the python or ruby host programs? How could I add extra packages to python used by neovim?

CC @teto, who has also tried to solve this I think.

Right, what I do is that I generate a neovim config per project.
basically I have a function genNeovim packageToDevelopFor manualConfig that tries to setups neovim for packageToDevelopFor, like if it’s a python program, it generates a python env with the package dependencies, same for haskell etc.
and it merges that config with the manual config.

I would very much like to merge it but I have too many projects right now it’s kinda hard so here is my mess
https://github.com/teto/nixpkgs/blob/290cf223202d6bccf89157f75d1c91837ed2710d/pkgs/applications/editors/neovim/module.nix
and the genNeovim function