NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.09k stars 14.14k forks source link

(n)vim plugins building does not work on unstable #145980

Closed matthiasbeyer closed 2 years ago

matthiasbeyer commented 2 years ago

Describe the bug

builder for '/nix/store/5mi6qxrksizwnrvfnypxlsqj8mjx0llw-vim-pack-dir.drv' failed with exit code 1; last 10 log lines:
  unpacking sources
  unpacking source archive /nix/store/irgk3ry0ynqj8nx3v42ry3pcihcl74rk-vim-plugins
  source root is vim-plugins
  patching sources
  configuring
  no configure script, doing nothing
  building
  no Makefile, doing nothing
  installing
  ln: /nix/store/0z4bqi4y3vckw7arfnfs8wp0yzd2mbd9-vim-pack-dir/pack/nixbundle/start/fzf/.: cannot overwrite directory

Steps To Reproduce

Not sure.

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.4.155, NixOS, 21.05.git.9e86f5f7a19 (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - channels(m): `""`
 - channels(root): `""`
 - nixpkgs: `/var/src/nixpkgs`

Issue exists after updating unstable from 4f6d8095fd51954120a1d08ea5896fe42dc3923b to c5ed8beb478a8ca035f033f659b60c89500a3034

sandhose commented 2 years ago

I also got hit by this problem. This seems caused by this PR: https://github.com/NixOS/nixpkgs/pull/145105 My system builds fine with the commit just before that (https://github.com/NixOS/nixpkgs/commit/d083ae6247661365d77c1e8b4633b02662ec7b14), but not after (https://github.com/NixOS/nixpkgs/commit/8605fbd737e526c40ff8f01219db42b5d0076e23)

Build logs ``` error: builder for '/nix/store/dy8x458qa7c8fjf5fkz9rmd6lw87bjj7-vim-pack-dir.drv' failed with exit code 1; last 10 log lines: > unpacking sources > unpacking source archive /nix/store/cn1rkqyjyikmksld9hgb3k8i140s8p11-vim-plugins > source root is vim-plugins > patching sources > configuring > no configure script, doing nothing > building > no Makefile, doing nothing > installing > ln: /nix/store/jsh5zza25zc7y5c0k7wyalbg5nnqmwy2-vim-pack-dir/pack/home-manager/start/rust-tools.nvim/.: cannot overwrite directory For full logs, run 'nix log /nix/store/dy8x458qa7c8fjf5fkz9rmd6lw87bjj7-vim-pack-dir.drv'. error: 1 dependencies of derivation '/nix/store/ah8521zh2q7gvy531vfb8r3kggrky7r5-hm_nviminit.vim.drv' failed to build error: 1 dependencies of derivation '/nix/store/vnadsdh08h7hvv7af319a2bjxfa8f2bm-hm_nviminit.vim.drv' failed to build error: 1 dependencies of derivation '/nix/store/aaq5v9xl7sl1qjxssk1l5pp3ikn4jhlp-manifest.vim.drv' failed to build error: 1 dependencies of derivation '/nix/store/4ag0gmjpxw2bz31hy3vfdyxkyn9d4zbk-home-manager-files.drv' failed to build error: 1 dependencies of derivation '/nix/store/h6pwxbmwas93c804qhlzj30bmlc3n0sz-home-manager-files.drv' failed to build error: 1 dependencies of derivation '/nix/store/vf2h7y1p9rlnxpwc4ga545xhlqkk7xz8-neovim-master.drv' failed to build error: 1 dependencies of derivation '/nix/store/i2vkbzz1drcww9wv910q7qqwdipshbin-home-manager-generation.drv' failed to build error: 1 dependencies of derivation '/nix/store/x4c441lhmnyqkg0n2mpfcfj2pdk3rb9r-home-manager-generation.drv' failed to build error: 1 dependencies of derivation '/nix/store/847yhriar78zfnlbb88d9rh10x045ps0-home-manager-path.drv' failed to build error: 1 dependencies of derivation '/nix/store/fr4yfa5a79pvpp095m3gv4zah1fs9czv-home-manager-path.drv' failed to build error: 1 dependencies of derivation '/nix/store/3jgcywkvl97bmp3qnll687cpib6ka9r6-unit-home-manager-root.service.drv' failed to build error: 1 dependencies of derivation '/nix/store/859piibkh239phbx0x8minah7sh1gk2d-user-environment.drv' failed to build error: 1 dependencies of derivation '/nix/store/w4ihyy1dny3fxqq8j9virmlz7vllg67i-etc.drv' failed to build error: 1 dependencies of derivation '/nix/store/hkacykh2ch7f8r43rw60bnxn581ki0hi-nixos-system-sandhose-desktop-21.11.20211108.8605fbd.drv' failed to build ```
jlesquembre commented 2 years ago

It would be nice to reproduce it locally, to find a proper fix. @matthiasbeyer @sandhose are you doing anything special to install the vim plugins? Do you have your configuration somewhere online?

sandhose commented 2 years ago

Sure. My config lives here: https://github.com/sandhose/nixconf/blob/c684f4c536a656ac4bf5ceb9508159f4b50b093b/profiles/home-manager/vim/default.nix

I'm configuring Neovim through the home-manager module.

jlesquembre commented 2 years ago

@sandhose thanks, I'm using home-manager too, but so far I cannot reproduce it, I'll take a look to your config

jlesquembre commented 2 years ago

@sandhose I can reproduce it, but looks like an error with you config, you are installing 2 times the same plugin, rust-tools-nvim here: https://github.com/sandhose/nixconf/blob/c684f4c536a656ac4bf5ceb9508159f4b50b093b/profiles/home-manager/vim/default.nix#L120 and here: https://github.com/sandhose/nixconf/blob/c684f4c536a656ac4bf5ceb9508159f4b50b093b/profiles/home-manager/vim/default.nix#L133

sandhose commented 2 years ago

@sandhose I can reproduce it, but looks like an error with you config, you are installing 2 times the same plugin, rust-tools-nvim here: https://github.com/sandhose/nixconf/blob/c684f4c536a656ac4bf5ceb9508159f4b50b093b/profiles/home-manager/vim/default.nix#L120 and here: https://github.com/sandhose/nixconf/blob/c684f4c536a656ac4bf5ceb9508159f4b50b093b/profiles/home-manager/vim/default.nix#L133

That was it 🤦 I was able to update nixpkgs, thanks!

jlesquembre commented 2 years ago

@matthiasbeyer in your case, is the same reason? Maybe we could try to add a better error message

matthiasbeyer commented 2 years ago

In my case it is

  packages.nixbundle.start = with (pkgs.vimPlugins // plugins); [
    vim-trailing-whitespace
    vim-signify
    fugitive
    undotree
    vim-toml
    Tabular
    editorconfig-vim
    vim-signature
    rust-vim
    vinegar
    ultisnips
    vim-snippets

    Tagbar
    vim-addon-nix
    vim-markbar
    fzf-preview

    ncm2
    ncm2-ultisnips
    ncm2-bufword
    ncm2-path
    ncm2-tmux
    ncm2-look
    ncm2-otherbuf

    unstable.vimPlugins.vim-which-key
    papercolor-theme
  ];

  packages.nixbundle.opt = with pkgs.vimPlugins; [
    LanguageClient-neovim
  ];

And I do not see that there is anything duplicated...

jlesquembre commented 2 years ago

@matthiasbeyer I see that you are using some out of tree vim plugins (fzf-preview is not in nixpkgs). Is the nix expression with those plugins public? Maybe a copy/paste error with your plugins? Did you forget to change the name/pname attribute for one of your plugins?

matthiasbeyer commented 2 years ago

fzf-preview: https://github.com/chengzeyi/fzf-preview.vim

None of my expressions are public, because they're in a git repository with private data. But here it is:

  "fzf-preview" = buildVimPlugin {
    name = "fzf-preview";
    src = fetchgit {
      url = "https://github.com/chengzeyi/fzf-preview.vim";
      rev = "d2a65fa13e044a6e0c8346df0af8ca17dc9f57db";
      sha256 = "1fw338mgn5y2nn6mhvcrgnw2i4ijga798ljpwbmkmfkvvjsb82ij";
    };
    dependencies = with pkgs; [ fzf vimPlugins.fzf-vim ];
  };

I checked that my plugins are named correctly and they are.

The error:

builder for '/nix/store/5mi6qxrksizwnrvfnypxlsqj8mjx0llw-vim-pack-dir.drv' failed with exit code 1; last 10 log lines:
  unpacking sources
  unpacking source archive /nix/store/irgk3ry0ynqj8nx3v42ry3pcihcl74rk-vim-plugins
  source root is vim-plugins
  patching sources
  configuring
  no configure script, doing nothing
  building
  no Makefile, doing nothing
  installing
  ln: /nix/store/0z4bqi4y3vckw7arfnfs8wp0yzd2mbd9-vim-pack-dir/pack/nixbundle/start/fzf/.: cannot overwrite directory

Indicates that there's something wrong with a fzf plugin, yes. But I do nothing fancy with fzf in my configuration:

$ rg fzf
basePackages.nix
9:  pkgs.fzf

vim/plugins.nix
107:  "fzf-preview" = buildVimPlugin {
108:    name = "fzf-preview";
110:      url = "https://github.com/chengzeyi/fzf-preview.vim";
114:    dependencies = with pkgs; [ fzf vimPlugins.fzf-vim ];

vim/customization.nix
29:    fzf-preview
jlesquembre commented 2 years ago

I think that is caused by dependencies = with pkgs; [ fzf vimPlugins.fzf-vim ];, fzf-vim also installs fzf in your vim plugins, you only need fzf-vim

matthiasbeyer commented 2 years ago

you're right, that solved the issue for me! Thanks!

But now it does not find fugitive#statusline() - I guess this is unrelated though!

jlesquembre commented 2 years ago

I don't think that the fugitive#statusline() error you are getting is related to this

matthiasbeyer commented 2 years ago

Hm,... maybe it is... it seems that fugitive cannot be found, although it is installed...