Vim with python3 support

Hi,

I am trying to setup vim with python3 support (needed for plugins).
The answer suggested in https://discourse.nixos.org/t/solved-help-getting-vim-with-python3-support-working/ does not work - it doesn’t allow me to rebuild the system. If I do what they suggest, I get an error:

error:
       … while calling the 'head' builtin

         at /nix/store/9kmwldghvsc66rn0ia81l3k742bxwgr3-nixos-23.11.4761.5bf1cadb72ab/nixos/lib/attrsets.nix:922:11:

          921|         || pred here (elemAt values 1) (head values) then
          922|           head values
             |           ^
          923|         else

       … while evaluating the attribute 'value'

         at /nix/store/9kmwldghvsc66rn0ia81l3k742bxwgr3-nixos-23.11.4761.5bf1cadb72ab/nixos/lib/modules.nix:807:9:

          806|     in warnDeprecation opt //
          807|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          808|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: function 'anonymous lambda' called with unexpected argument 'python'

       at /nix/store/9kmwldghvsc66rn0ia81l3k742bxwgr3-nixos-23.11.4761.5bf1cadb72ab/nixos/pkgs/applications/editors/vim/full.nix:1:1:

            1| { source ? "default", callPackage, lib, stdenv, ncurses, pkg-config, gettext
             | ^
            2| , writeText, config, glib, gtk2-x11, gtk3-x11, lua, python3, perl, tcl, ruby
       Did you mean python3?

What fixes this error is changing python = ... to python3 = ...
My vim.nix file looks like:

{ pkgs, ... }:

let
  myVim = pkgs.vim_configurable.override {
    python3 = pkgs.python3;
  };
in
{
  programs.vim.defaultEditor = true;

  environment.systemPackages = with pkgs; [
    (myVim.customize {
      name = "vim-with-python3";
      vimrcConfig.packages.myplugins = with pkgs.vimPlugins; {
        start = [ vim-nix ]; # load plugins on startup
      };
      vimrcConfig.customRC = ''
        " custom vimrc settings
      '';
    })
  ];
}

This, however, still doesn’t compile with python3 support (:echo has('python3') returns 0)

Does anybody know how to fix this?

Thanks!

have you tried setting

programs.vim.package = myVim;

Which plugins are you trying to install ?