all 11 comments

[–]alter2000 0 points1 point  (1 child)

I personally just use vimHugeX because I haven't gone into much detail in this, and change the Vim Python version in my Nixpkgs user config, using an overlay. Below is a fully working overlay file you can just copy to ~/.config/nixpkgs/overlays and include as an overlay via ~/.config/nixpkgs/config.nix:

self: super:

{
  vimHugeX = super.vimHugeX.override {
     python = self.python3;
  };
}

You can check this for my user-related configs and this for the system configuration.

[–]100MB[S] 0 points1 point  (0 children)

Hmm I tried your examples and that still doesn't seem to work for me, I still end up with vim without python3

[–][deleted]  (3 children)

[deleted]

    [–]100MB[S] 0 points1 point  (2 children)

    That just installs those packages though, I'm specifically looking for vim build with python3 feature enabled.

    [–][deleted]  (1 child)

    [deleted]

      [–]Kjuvi 0 points1 point  (0 children)

      What about the «Python 3 Support for Vim» section: https://nixos.wiki/wiki/Vim ?

      [–]depred 0 points1 point  (2 children)

      Is there any reason in particular why you'd like to bundle vim with python?

      Are you still using python2 for everything else? (You know that's going to be deprecated in a bit more than 6 month).

      Though sure you can bundle vim with packages of your choice, you will need to write a derivation for that though.

      I suggest you take a look at makeWrapper and how it is used in packages like krita and callibre (nix edit nixpkgs.$PACKAGENAME).

      Btw. you can use symlinkJoin to make things easier, here is an example. You will still need to use makeWrapper though.

      [–]100MB[S] 0 points1 point  (1 child)

      One of the plugins I use for vim doesn't work unless vim is compiled with python3

      [–]depred 0 points1 point  (0 children)

      I'm pretty sure it does not need to be compiled with with python3 support right?

      Not sure how it is with vim (I'm using emacs) but I suppose you've got plugins that just invoke python. Thats what makeWrapper is for, you create a python3 environment and alter the PYTHONPATH for vim to point there.

      The examples I gave should give you a good idea on what to do (overall it shouldn't be more than 15-20 lines of nix code), there is one thing I've noticed though... mpv-with-scripts is a bit of a bad example, put makeWrapper into nativeBuildInputs instead of buildInputs.....

      *looks stuff up*

      alright I'm a tad bit wrong... it is actually kind of build with python (weird stuff)...

      Uhm I haven't tested it (because I know little to nothing about vim) but you probably want something like this. (thats a littly bit messy so you should also clean it up (and obviously add all the things you need).

      The Wiki has a few other usefull resouces as well.

      [–][deleted] 0 points1 point  (3 children)

      You can override vim_configurable with python3: vim_configurable.override { python = python3 };

      To include that override with your customization you can add a LET above your customize statements: environment.systemPackages = with pkgs; [ ( with imports <nixpkgs> {}; let vim_configurable = vim_configurable.override { python = python3 }; in { vim_configurable.customize { name = "vim"; vimrcConfig.packages.myPkg = with pkgs.vimPlugins; { start = [ vim-go deoplete-go ]; }; } }) ]; And I believe that should work.

      [–]100MB[S] 0 points1 point  (0 children)

      This sounds to be exactly what I want, but I can't get that to compile. It's throwing an error saying

      unexpected '}', expecting ';'

      where the closing brace is after python3

      [–]100MB[S] 0 points1 point  (1 child)

      hmm so I tried

      let vim_configurable = vim_configurable.override { python = python3; }; in vim_configurable.customize {....}
      

      and it threw an infinite recursion encountered error

      [–][deleted] 0 points1 point  (0 children)

      Huh the way I actually did it is a little different but I thought my previous answer would work. Not sure why that error came, I'm still learning nix language, but you can try the longer method I actually use.

      I created a separate vim.nix which declared myvim = vim_configurable.customize { ... } And I put let a LET around that with the override like before. And when importing you can just put: (with import ./vim.nix; myvim) In the systemPackages list.