Nixpkgs: nixos-unstable broken by missing `pname` attribute in vim-plugins

Created on 31 Dec 2018  路  9Comments  路  Source: NixOS/nixpkgs

Issue description

root # nixos-rebuild switch --upgrade
unpacking channels...
building Nix...
building the system configuration...
error: attribute 'pname' missing, at /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/misc/vim-plugins/vim-utils.nix:258:41
(use '--show-trace' to show detailed location information)

Steps to reproduce

nixos-rebuild switch --upgrade

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.14.59, NixOS, 19.03pre162671.44b02b52ea6 (Koi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.1.3
  • channels(root): "nixos-19.03pre164715.201d739b0ff"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
bug regression

Most helpful comment

Okay, should be fixed with #53121. Sorry for the breakage! Its hard to predict all the possible ways people may be using vim-utils.nix. We need more tests. I've added your example as a test to make sure this doesn't happen again.

All 9 comments

cc @timokau

I'm not entirely sure this is the same bug. What is your vim/neovim setup @8573?

  • do you use vim or neovim
  • which plugins are installed with which plugin manager (vam/vim-plug/pathogen/vim packages)

It would be best to just post the vim_configurable.configure or neovim.override expression in your configure.nix.

Hello, I have the same problem, and #53113 did not solve the problem.

It turns out that I was using pkgs.vimUtils.buildVimPluginFrom2Nix to define some custom vim plugins (which nixpkgs don't have). I did not define the pname attribute in those plugin's derivation, and at the same time https://github.com/timokau/nixpkgs/blob/d9d9ac989ab8a6bf9a89f951857fa83f45956baa/pkgs/misc/vim-plugins/vim-utils.nix#L172 tries to access the pname attribute.

Maybe you should not assume that pname is always in plugin derivation's attribute?

Can you give a minimal example with buildVimPluginsFrom2Nix to reproduce the failure?

The expression:


vim.nix (click to expand)

pkgs:
let
  cfg = {
    vimrcConfig.vam.knownPlugins =
      pkgs.vimPlugins // ({
        "vim-trailing-whitespace" = pkgs.vimUtils.buildVimPluginFrom2Nix rec {
          name = "vim-trailing-whitespace";
          src = pkgs.fetchFromGitHub {
            owner = "bronson";
            repo = "vim-trailing-whitespace";
            rev = "4c596548216b7c19971f8fc94e38ef1a2b55fee6";
            sha256 = "0f1cpnp1nxb4i5hgymjn2yn3k1jwkqmlgw1g02sq270lavp2dzs9";
          };
          dependencies = [];
        };
      });
    vimrcConfig.vam.pluginDictionaries =
      [ { names = [ "vim-trailing-whitespace"
                  ];
        } ];
    name = "vim";
  };
in
  pkgs.lib.overrideDerivation (pkgs.vim_configurable.customize cfg) (o: { })

Then use nix repl to build it:

nix-repl> pkgs = import <nixpkgs> {}

nix-repl> :b import ./vim.nix pkgs
error: attribute 'pname' missing, at /nix/store/0xxqwhx8bllq2cyns1c1pqnpkwgwpp74-nixos-19.03pre164715.201d739b0ff/nixos/pkgs/misc/vim-plugins/vim-utils.nix:258:41

Thanks!

Okay, should be fixed with #53121. Sorry for the breakage! Its hard to predict all the possible ways people may be using vim-utils.nix. We need more tests. I've added your example as a test to make sure this doesn't happen again.

What is your vim/neovim setup @8573? [...] It would be best to just post the vim_configurable.configure or neovim.override expression in your configure.nix.

https://github.com/8573/nixos-config/blob/54ea70cd9beb999c7d430dfd41207c5db8c381e4/modules/programs/vim/default.nix

I guess I share @sifmelcara's issue; thanks for (I hope) fixing it.

I confirm that this issue appears to be fixed for me. Thanks, @timokau!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

domenkozar picture domenkozar  路  3Comments

lverns picture lverns  路  3Comments

matthiasbeyer picture matthiasbeyer  路  3Comments

langston-barrett picture langston-barrett  路  3Comments

vaibhavsagar picture vaibhavsagar  路  3Comments