How to custom package vim plugin on nixos?

Should be something like this:

# ./vim-with-plugins.nix
{ pkgs, ... }:

let
  NeoDebug = pkgs.vimUtils.buildVimPlugin {
    name = "vim-NeoDebug";
    src = pkgs.fetchFromGitHub {
      owner = "cpiger";
      repo = "NeoDebug";
      rev = "545d32f75dff49de5bf1d13022057eeb9ba5582d";
      hash = "";
    };
  };
in
{
  environment.variables = { EDITOR = "vim"; };
 
  environment.systemPackages = with pkgs; [
    ((vim-full.override {  }).customize{
      name = "vim-with-plugins";
      # Install plugins for example for syntax highlighting of nix files
      vimrcConfig.packages.myplugins = with pkgs.vimPlugins; {
        start = [ 
          lightline-vim 
          fzfWrapper 
          vim-visual-multi 
          vim-surround 
          nerdtree 
          coc-nvim 
          auto-pairs 
          gruvbox 
          vim-cmake 
          NeoDebug
        ];
        opt = [];
      };
      vimrcConfig.customRC = ''
        <removed for brevity>
      '';
    }
  )];
}

You’ll need to fill in the hash, just try to build it and read the error message.

2 Likes