Building nvim-neotree?

Hi all! So I’m trying to build neo-tree.nvim for my project’s dev env like this:

{pkgs ? import <nixpkgs> {}}: pkgs.mkShell {
  name = "shell";
  nativeBuildInputs = with pkgs; [
    (neovim.override { vimAlias = true; configure = {
      packages.myNeovimPlugins = with pkgs.vimPlugins; { opt = []; start = [
        ((pkgs.vimUtils.buildVimPlugin {
          pname = "neo-tree";
          version = "2.9";
          buildPhase = "";
          src = pkgs.fetchFromGitHub {
            owner  = "nvim-neo-tree";
            repo   = "neo-tree.nvim";
            rev    = "v2.9";
            sha256 = "1a42acrw12cipwwags5ljha52ygackcx501y4bxxqhr6gma3px2r";
          };
        }).overrideAttrs (old: { doBuild = false; }))
      ]; };
    }; })
  ];
}

and it fails with this output:

these 6 derivations will be built:
  /nix/store/451gsh8z3g6c5sf2ii3rkllgc949ql2i-source.drv
  /nix/store/ji9c48fz0gbw1a0a85pv7awplmfz77qr-vimplugin-neo-tree-2.9.drv
  /nix/store/gmmh1q20hkjx11acfzsnka3321a2iv9p-vim-pack-dir.drv
  /nix/store/514j1gn3697k5fq1ilk8nicxjz0ax9r0-init.vim.drv
  /nix/store/dlrwia1b0h3ii5bz0s62fxqdy1mr0rm9-manifest.vim.drv
  /nix/store/fpwx7s6v26svrd8yk13pbkjlmn6qhd5g-neovim-0.6.1.drv
this path will be fetched (5.24 MiB download, 23.22 MiB unpacked):
  /nix/store/fbiqq7xgkh0alp0hbhbpnybjfzfl9avr-neovim-unwrapped-0.6.1
copying path '/nix/store/fbiqq7xgkh0alp0hbhbpnybjfzfl9avr-neovim-unwrapped-0.6.1' from 'https://cache.nixos.org'...
building '/nix/store/451gsh8z3g6c5sf2ii3rkllgc949ql2i-source.drv'...

trying https://github.com/nvim-neo-tree/neo-tree.nvim/archive/v2.9.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   143  100   143    0     0    220      0 --:--:-- --:--:-- --:--:--   220
100 87260    0 87260    0     0  79674      0 --:--:--  0:00:01 --:--:-- 79674
unpacking source archive /build/v2.9.tar.gz
building '/nix/store/ji9c48fz0gbw1a0a85pv7awplmfz77qr-vimplugin-neo-tree-2.9.drv'...
Sourcing vim-gen-doc-hook
unpacking sources
unpacking source archive /nix/store/0lv6jqdni8nxx5bdcx7v7cmq91pfgc24-source
source root is source
patching sources
configuring
no configure script, doing nothing
building
build flags: SHELL=/nix/store/ld19k12mf0pa42ff43qs3sizamp09f03-bash-5.1-p16/bin/bash

TEST WITH BLANK CONFIG 
nvim --headless --noplugin -u tests/mininit.lua -c "lua require('plenary.test_harness').test_directory('tests/neo-tree/', {minimal_init='tests/mininit.lua',sequential=true})"
/nix/store/ld19k12mf0pa42ff43qs3sizamp09f03-bash-5.1-p16/bin/bash: line 1: nvim: command not found
make: *** [Makefile:5: test] Error 127
error: builder for '/nix/store/ji9c48fz0gbw1a0a85pv7awplmfz77qr-vimplugin-neo-tree-2.9.drv' failed with exit code 2;
       last 10 log lines:
       > patching sources
       > configuring
       > no configure script, doing nothing
       > building
       > build flags: SHELL=/nix/store/ld19k12mf0pa42ff43qs3sizamp09f03-bash-5.1-p16/bin/bash
       >
       > TEST WITH BLANK CONFIG
       > nvim --headless --noplugin -u tests/mininit.lua -c "lua require('plenary.test_harness').test_directory('tests/neo-tree/', {minimal_init='tests/mininit.lua',sequential=true})"
       > /nix/store/ld19k12mf0pa42ff43qs3sizamp09f03-bash-5.1-p16/bin/bash: line 1: nvim: command not found
       > make: *** [Makefile:5: test] Error 127
       For full logs, run 'nix log /nix/store/ji9c48fz0gbw1a0a85pv7awplmfz77qr-vimplugin-neo-tree-2.9.drv'.
error: 1 dependencies of derivation '/nix/store/gmmh1q20hkjx11acfzsnka3321a2iv9p-vim-pack-dir.drv' failed to build
error: 1 dependencies of derivation '/nix/store/514j1gn3697k5fq1ilk8nicxjz0ax9r0-init.vim.drv' failed to build
error: 1 dependencies of derivation '/nix/store/fpwx7s6v26svrd8yk13pbkjlmn6qhd5g-neovim-0.6.1.drv' failed to build

How to bypass the build phase which runs the tests?

1 Like

Since buildVimPlugin uses stdenv.mkDerivation (see here), I think adding doCheck=false should do the trick

I’m not too sure why doBuild is not affecting it, but you can use buildVimPluginFrom2Nix (source) which works. Its just a slightly modified version of buildVimPlugin which sets the buildPhase and configurePhase to : (??? why does this work?).