0

I'm trying to add a neovim plugin that doesn't exist in nixpkgs yet (modes.nvim), but having trouble getting it to work.

I'm using NixOS 22.05, and Home Manager, and I am using the following to build this plugin:

pkgs.vimUtils.buildVimPlugin {
  name = "modes-nvim";
  src = pkgs.fetchFromGitHub {
    owner = "mvllow";
    repo = "modes.nvim";
    rev = "3188692abf02a8838ec75e59d68c2ce3e4323f5c";
    sha256 = "sha256-2QDpwQ9+F5t5gTR1KLVzRrvriwo5JUHatZEJnc0ojV8=";
  };
}

Initially, I used lib.pkgs.fakeSha256 to get a "mismatched hash" error, and copy/pasted the has from that error message, so I think it's correct, though other things I've seen on the internet seem to have the SHA256 as a hex string, so not sure what's going on there.

When I run home-manager switch, I get the following error:

these 12 derivations will be built:
  /nix/store/pna2lzjc3q56z59b2kfazzxi8m6swp8d-vimplugin-modes-nvim.drv
  /nix/store/mnj1d881d8s57yj3y8wjy7i9nl3m089f-vimplugin-modes-nvim.drv
  /nix/store/5l8vqvx2bbawkkj92s8qd0p5hw16pcmq-vim-pack-dir.drv
  /nix/store/jgqf68sd50s79pydzs9154p509l5109v-hm_nviminit.vim.drv
  /nix/store/rq8f75qr9ahrfr0hvp51inn19088bz5p-manifest.vim.drv
  /nix/store/hbzm2xr6nv8mr2l9nrlf742fqdmw9nv3-neovim-0.7.2.drv
  /nix/store/zks47ifk7njz1s8y7hvq357ac8z6azkd-neovim-0.7.2-fish-completions.drv
  /nix/store/rkaa094vvyjcyy4v1zkh4f8xz64vqxas-cameron-fish-completions.drv
  /nix/store/0073403x9b4wv13gm7a6bqy4765pi8g5-home-manager-files.drv
  /nix/store/lxwpbhb6ryhwrff4cjyniff11843cf9x-home-manager-path.drv
  /nix/store/xbbn44253wjh90md4hqrrc2wfpafkc55-activation-script.drv
  /nix/store/ijwmv897xc2wlr1ij4a30vk4z154ikbf-home-manager-generation.drv
building '/nix/store/pna2lzjc3q56z59b2kfazzxi8m6swp8d-vimplugin-modes-nvim.drv'...
Sourcing vim-command-check-hook.sh
Using vimCommandCheckHook
Sourcing vim-gen-doc-hook
unpacking sources
unpacking source archive /nix/store/fcxyif8piqar9w9ynmi6ym71hw6zsy7a-source
source root is source
patching sources
configuring
no configure script, doing nothing
building
build flags: SHELL=/nix/store/iffl6dlplhv22i2xy7n1w51a5r631kmi-bash-5.1-p16/bin/bash
test -r dependencies/pack/vendor/start/plenary.nvim || git clone --depth=1 https://github.com/nvim-lua/plenary.nvim.git dependencies/pack/vendor/start/plenary.nvim
/nix/store/iffl6dlplhv22i2xy7n1w51a5r631kmi-bash-5.1-p16/bin/bash: line 1: git: command not found
make: *** [Makefile:7: install_dependencies] Error 127
error: builder for '/nix/store/pna2lzjc3q56z59b2kfazzxi8m6swp8d-vimplugin-modes-nvim.drv' failed with exit code 2;
       last 10 log lines:
       > unpacking source archive /nix/store/fcxyif8piqar9w9ynmi6ym71hw6zsy7a-source
       > source root is source
       > patching sources
       > configuring
       > no configure script, doing nothing
       > building
       > build flags: SHELL=/nix/store/iffl6dlplhv22i2xy7n1w51a5r631kmi-bash-5.1-p16/bin/bash
       > test -r dependencies/pack/vendor/start/plenary.nvim || git clone --depth=1 https://github.com/nvim-lua/plenary.nvim.git dependencies/pack/vendor/start/plenary.nvim
       > /nix/store/iffl6dlplhv22i2xy7n1w51a5r631kmi-bash-5.1-p16/bin/bash: line 1: git: command not found
       > make: *** [Makefile:7: install_dependencies] Error 127
       For full logs, run 'nix log /nix/store/pna2lzjc3q56z59b2kfazzxi8m6swp8d-vimplugin-modes-nvim.drv'.
error: 1 dependencies of derivation '/nix/store/mnj1d881d8s57yj3y8wjy7i9nl3m089f-vimplugin-modes-nvim.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5l8vqvx2bbawkkj92s8qd0p5hw16pcmq-vim-pack-dir.drv' failed to build
error: 1 dependencies of derivation '/nix/store/jgqf68sd50s79pydzs9154p509l5109v-hm_nviminit.vim.drv' failed to build
error: 1 dependencies of derivation '/nix/store/rq8f75qr9ahrfr0hvp51inn19088bz5p-manifest.vim.drv' failed to build
error: 1 dependencies of derivation '/nix/store/0073403x9b4wv13gm7a6bqy4765pi8g5-home-manager-files.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hbzm2xr6nv8mr2l9nrlf742fqdmw9nv3-neovim-0.7.2.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ijwmv897xc2wlr1ij4a30vk4z154ikbf-home-manager-generation.drv' failed to build

It appears to be failing due to git not being found. Of course, I have git installed for me, but perhaps this command is being run in an environment that doesn't have access to my installed packages.

I'm very new to Nix and NixOS, so I'm not really sure how to begin fixing this issue. I've searched online for answers, but haven't found anything about this issue. Any advice is much appreciated.

cameron1024
  • 9,083
  • 2
  • 16
  • 36
  • Have you read https://nixos.org/manual/nixpkgs/stable/#managing-plugins-with-vim-packages? – Atemu Jul 17 '22 at 20:12
  • I hadn't seen that page, but the setup there seems to be different to mine. I am enabling neovim through `packages.neovim = { enable = true; /* other config */ }`. I'm not sure where `environment` is coming from :/ – cameron1024 Jul 17 '22 at 21:45
  • Adding the `environment` section into `programs.neovim` gave an error that `programs.neovim.environment` doesn't exist. Where should that snippet go instead? – cameron1024 Jul 17 '22 at 21:50
  • `environment.systemPackages` is a NixOS thing. That's just where you put your derivation in the end. In home-manager you'd put it in `home.packages` instead. Your problem is getting a working derivation though (a packaging issue), not where to put it. In `17.34.2.1.`, only the part in the `let` statement is important to you. – Atemu Jul 19 '22 at 10:27

0 Answers0