Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos-unstable broken by missing pname attribute in vim-plugins #53112

Closed
8573 opened this issue Dec 31, 2018 · 9 comments
Closed

nixos-unstable broken by missing pname attribute in vim-plugins #53112

8573 opened this issue Dec 31, 2018 · 9 comments
Labels
0.kind: bug 0.kind: regression Something that worked before working no longer

Comments

@8573
Copy link
Contributor

8573 commented Dec 31, 2018

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
@8573 8573 changed the title nixos-unstable broken by missing pname attribute nixos-unstable broken by missing pname attribute in vim-plugins Dec 31, 2018
@FRidh FRidh added 0.kind: bug 0.kind: regression Something that worked before working no longer labels Dec 31, 2018
@FRidh
Copy link
Member

FRidh commented Dec 31, 2018

cc @timokau

@FRidh
Copy link
Member

FRidh commented Dec 31, 2018

Broken by #52767
Proposed fix #53113

@timokau
Copy link
Member

timokau commented Dec 31, 2018

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.

@sifmelcara
Copy link
Member

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?

@timokau
Copy link
Member

timokau commented Dec 31, 2018

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

@sifmelcara
Copy link
Member

sifmelcara commented Dec 31, 2018

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!

timokau added a commit to timokau/nixpkgs that referenced this issue Dec 31, 2018
For backwards compatibility. The user may specify their own plugins
without the pname attribute. In that case the attrname of the plugin
(given as a string) is the pname.

Fixes NixOS#53112
@timokau
Copy link
Member

timokau commented Dec 31, 2018

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.

timokau added a commit that referenced this issue Dec 31, 2018
For backwards compatibility. The user may specify their own plugins
without the pname attribute. In that case the attrname of the plugin
(given as a string) is the pname.

Fixes #53112
@8573
Copy link
Contributor Author

8573 commented Dec 31, 2018

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.

@8573
Copy link
Contributor Author

8573 commented Jan 7, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 0.kind: regression Something that worked before working no longer
Projects
None yet
Development

No branches or pull requests

4 participants