Bash: command not found

Hi all,

I’m trying to install telescope.nvim in my neovim overlay:

customPlugins.telescope-nvim = super.vimUtils.buildVimPlugin {
    pname = "telescope-nvim";
    version = "2020-11-01";
    src = super.fetchFromGitHub {
      owner = "nvim-lua";
      repo = "telescope.nvim";
      rev = "54ef9d90d5a032906bfb007113930dac0f665f72";
      sha256 = "0zh6dpxfibm0clafs2zsnb4ffmh3438qiccc60md2s7hwhzynvyq";
    };
    meta.homepage = "https://github.com/nvim-lua/telescope.nvim/";
  };

  neovim = super.neovim.override {
    configure = {
        packages.myVimPackage = with super.vimPlugins; {
          start = [ self.customPlugins.telescope-nvim];};
  };
};

However, during the build I get a command not found error from bash found in nix/store/ :

build flags: SHELL=/nix/store/8i9kyqfxhk2s9dzx32x0sgdk7kyx9wjc-bash-4.4-p23/bin/bash
nvim --headless -c 'lua require("plenary.test_harness"):test_directory("busted", "./lua/tests/automated/")'
/nix/store/8i9kyqfxhk2s9dzx32x0sgdk7kyx9wjc-bash-4.4-p23/bin/bash: nvim: command not found
make: *** [Makefile:2: test] Error 127

I logged into this shell and I can run nvim. Any ideas why it fails to find it during the build?

https://github.com/nvim-lua/telescope.nvim/blob/54ef9d90d5a032906bfb007113930dac0f665f72/Makefile#L2

The upstream plugin defines a ‘test’ action in it’s Makefile that is being run by buildVimPlugin. ‘nvim’ is not in the path for this build step.

I would try either adding nvim to the buildInputs for buildVimPlugin, or – if the test isn’t important to you --removing the makefile/test action using a patch or some other mechanism.

This patch worked for me to skip the test phase.

    patches = [
      (pkgs.writeText "patch" ''
        diff --git a/Makefile b/Makefile
        deleted file mode 100644
        index ca6b84d..0000000
        --- a/Makefile
        +++ /dev/null
        @@ -1,2 +0,0 @@
        -test:
        -	nvim --headless -c 'lua require("plenary.test_harness"):test_directory("busted", "./lua/tests/automated/")'
      '')
    ];

Thanks for the help @mattchrist! Still new to this so just a followup question.

I get an undefined variable: nvim message with this:

self: super: {
  neovim-unwrapped = super.neovim-unwrapped.overrideAttrs (oldAttrs: {
    version = "master";
    src = super.fetchFromGitHub {
      owner = "neovim";
      repo = "neovim";
      rev = "ca7449db46062098cc9b0c84401655cba7d3a53f";
      sha256 = "1cdb3qxygx45f8i1k12rsqvc4fj94a8lk5k4m06fh8231iq9mksh";
    };
  });

  customPlugins.telescope-nvim = super.vimUtils.buildVimPlugin {
    pname = "telescope-nvim";
    version = "2020-11-01";
    src = super.fetchFromGitHub {
      owner = "nvim-lua";
      repo = "telescope.nvim";
      rev = "54ef9d90d5a032906bfb007113930dac0f665f72";
      sha256 = "0zh6dpxfibm0clafs2zsnb4ffmh3438qiccc60md2s7hwhzynvyq";
    };
    meta.homepage = "https://github.com/nvim-lua/telescope.nvim/";
    buildInputs = [ nvim ];
  };

  neovim = super.neovim.override {
    vimAlias = true;
    viAlias = true;
    withPython3 = true;
    configure = {
        packages.myVimPackage = with super.vimPlugins; {
          start = [
            gruvbox
            self.customPlugins.telescope-nvim
            calendar-vim
            coc-nvim
            coc-markdownlint
            csv
            fzf-vim
            fzfWrapper
            goyo-vim
            limelight-vim
            gruvbox
            julia-vim
            vim-easy-align
            vim-nix
            vim-pandoc
            vim-pandoc-syntax
            vim-peekaboo
            vim-pencil
            vim-rooter
            vim-slime
            vim-tmux-navigator
            vimux
            vimwiki
          ];
        };

      customRC = builtins.readFile /Users/OliverW/.config/nvim/init.vim;
    };
  };
}

Is my syntax wrong?

super.neovim should do it.

That said, I ran into subsequent issues after trying that – it’s trying to find the plenary module to run the tests which also isn’t available. I’m not sure how to go about making that module available to the test command, if you’re okay disabling tests, see my other reply for a patch that removes the Makefile.

Thank you, this worked! Much appreciated.