Help with adding a vim plugin in nixpkgs

So i’m trying to add a vim plugin ( GitHub - jannis-baum/vivify.vim: Live Markdown viewer for Vim and Neovim powered by Vivify · GitHub it’s just the vim package for GitHub - jannis-baum/Vivify: Live viewer for Markdown, HTML, Jupyter Notebooks & more · GitHub which is already in nixpkgs).

It’s my first time adding a package. From what I understodd, I need to

  1. fork the repo (already did that)

  2. clone it in my machine (already did that)

  3. add the necessary files inside nixpkgs (where there is a probleme)

  4. open a pull request

To understand how to add a package I used the following guides

nixpkgs/doc/languages-frameworks/vim.section.md at b934c1480127f9365061a3ad8184c5c2b9dc4455 · NixOS/nixpkgs · GitHub

In this guide i saw two commands that could help me: (this might be the same thing but the second just being a wrapper to the first one)

(1) nix-shell -p vimPluginsUpdater --run 'vim-plugins-updater add "jannis-baum/vivify.vim"'

(2) ./update.py add “jannis-baum/vivify.vim”

What happened with (1) :
(I placed myself in /nixpkgs/pkgs/applications/editors/vim/plugins)
It gave me this following error:

Traceback (most recent call last):
File “/nix/store/kyqz14cmsir4a1pv4mjlr3i1cw1wvwqg-vim-plugins-updater-0.1/bin/..vim-plugins-updater-wrapped-wrapped”, line 171, in 
main()
~~~~^^
File “/nix/store/kyqz14cmsir4a1pv4mjlr3i1cw1wvwqg-vim-plugins-updater-0.1/bin/..vim-plugins-updater-wrapped-wrapped”, line 167, in main
editor.run()
~~~~~~~~~~^^
File “/nix/store/dl2914y1nd40rv8vpxbsw2pb9sc9v2fk-python3.13-nixpkgs-plugin-update-0.1.0/lib/python3.13/site-packages/nixpkgs_plugin_update/`**`init`**`.py”, line 724, in run`
getattr(self, command)(args)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File “/nix/store/dl2914y1nd40rv8vpxbsw2pb9sc9v2fk-python3.13-nixpkgs-plugin-update-0.1.0/lib/python3.13/site-packages/nixpkgs_plugin_update/`**`init`**`.py”, line 380, in add`
editor.rewrite_input(
~~~~~~~~~~~~~~~~~~~~^
fetch_config, args.input_file, editor.deprecated, append=append
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File “/nix/store/dl2914y1nd40rv8vpxbsw2pb9sc9v2fk-python3.13-nixpkgs-plugin-update-0.1.0/lib/python3.13/site-packages/nixpkgs_plugin_update/`**`init`**`.py”, line 606, in rewrite_input`
return rewrite_input(*args, **kwargs)
File “/nix/store/dl2914y1nd40rv8vpxbsw2pb9sc9v2fk-python3.13-nixpkgs-plugin-update-0.1.0/lib/python3.13/site-packages/nixpkgs_plugin_update/`**`init`**`.py”, line 893, in rewrite_input`
plugins = load_plugins_from_csv(config, input_file)
File “/nix/store/dl2914y1nd40rv8vpxbsw2pb9sc9v2fk-python3.13-nixpkgs-plugin-update-0.1.0/lib/python3.13/site-packages/nixpkgs_plugin_update/`**`init`**`.py”, line 311, in load_plugins_from_csv`
with open(input_file, newline=“”) as csvfile:
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: ‘pkgs/applications/editors/vim/plugins/vim-plugin-names’

which was odd because the file did exist
I thought it might be a path issue. So i cd into /nixpkgs/ and rerun the command

path is '/nix/store/rg81b3sc4fmx4wa2lf0fwarf9kj4q3lm-99a1539a440633ee7a164e094a736c04acc2335d.tar.gz'
error:
       … while calling the 'mapAttrs' builtin
         at «string»:33:1:
           32| in
           33| lib.mapAttrs parse generated
             | ^
           34|

       … while calling a functor (an attribute set with a '__functor' attribute)
         at /home/tomasr/pkgs/nixpkgs/lib/customisation.nix:333:7:
          332|     if missingArgs == { } then
          333|       makeOverridable f allArgs
             |       ^
          334|     # This needs to be an abort so it can't be caught with `builtins.tryEval`,

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: function 'anonymous lambda' called with unexpected argument 'buildNeovimPlugin'
       at /home/tomasr/pkgs/nixpkgs/pkgs/applications/editors/vim/plugins/generated.nix:2:1:
            1| # GENERATED by ./pkgs/applications/editors/vim/plugins/utils/update.py. Do not edit!
            2| {
             | ^
            3|   lib,
Traceback (most recent call last):
  File "/nix/store/kyqz14cmsir4a1pv4mjlr3i1cw1wvwqg-vim-plugins-updater-0.1/bin/..vim-plugins-updater-wrapped-wrapped", line 171, in <module>
    main()
    ~~~~^^
  File "/nix/store/kyqz14cmsir4a1pv4mjlr3i1cw1wvwqg-vim-plugins-updater-0.1/bin/..vim-plugins-updater-wrapped-wrapped", line 167, in main
    editor.run()
    ~~~~~~~~~~^^
  File "/nix/store/dl2914y1nd40rv8vpxbsw2pb9sc9v2fk-python3.13-nixpkgs-plugin-update-0.1.0/lib/python3.13/site-packages/nixpkgs_plugin_update/__init__.py", line 724, in run
    getattr(self, command)(args)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/nix/store/dl2914y1nd40rv8vpxbsw2pb9sc9v2fk-python3.13-nixpkgs-plugin-update-0.1.0/lib/python3.13/site-packages/nixpkgs_plugin_update/__init__.py", line 389, in add
    update = self.get_update(
        args.input_file,
    ...<2 lines>...
        [plugin.normalized_name],
    )
  File "/nix/store/dl2914y1nd40rv8vpxbsw2pb9sc9v2fk-python3.13-nixpkgs-plugin-update-0.1.0/lib/python3.13/site-packages/nixpkgs_plugin_update/__init__.py", line 502, in get_update
    current_plugins = self.get_current_plugins(config, self.nixpkgs)
  File "/nix/store/dl2914y1nd40rv8vpxbsw2pb9sc9v2fk-python3.13-nixpkgs-plugin-update-0.1.0/lib/python3.13/site-packages/nixpkgs_plugin_update/__init__.py", line 427, in get_current_plugins
    data = run_nix_expr(self.get_plugins, nixpkgs)
  File "/nix/store/dl2914y1nd40rv8vpxbsw2pb9sc9v2fk-python3.13-nixpkgs-plugin-update-0.1.0/lib/python3.13/site-packages/nixpkgs_plugin_update/__init__.py", line 342, in run_nix_expr
    out = subprocess.check_output(cmd, **args)
  File "/nix/store/f8xmcwbyw8am8ybkdvzsj0ln6mlr559i-python3-3.13.11/lib/python3.13/subprocess.py", line 472, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               **kwargs).stdout
               ^^^^^^^^^
  File "/nix/store/f8xmcwbyw8am8ybkdvzsj0ln6mlr559i-python3-3.13.11/lib/python3.13/subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['nix', 'eval', '--extra-experimental-features', 'nix-command', '--impure', '--json', '--expr', 'with import <localpkgs> { };\nlet\n  inherit (vimUtils.override { inherit vim; }) buildVimPlugin;\n  inherit (neovimUtils) buildNeovimPlugin;\n\n  generated = callPackage <localpkgs/pkgs/applications/editors/vim/plugins/generated.nix> {\n    inherit buildNeovimPlugin buildVimPlugin;\n  } { } { };\n\n  hasChecksum =\n    value:\n    lib.isAttrs value\n    && lib.hasAttrByPath [\n      "src"\n      "outputHash"\n    ] value;\n\n  parse = name: value: {\n    pname = value.pname;\n    version = value.version;\n    homePage = value.meta.homepage;\n    checksum =\n      if hasChecksum value then\n        {\n          submodules = value.src.fetchSubmodules or false;\n          sha256 = value.src.outputHash;\n          rev = value.src.rev;\n        }\n      else\n        null;\n  };\nin\nlib.mapAttrs parse generated\n', '--nix-path', 'localpkgs=/home/tomasr/pkgs/nixpkgs']' returned non-zero exit status 1.

I don’t remember why? but i tried to run nix-shell -p vimPluginsUpdater vimUtils --run 'vim-plugin-updater "jannis-baum/vivify.vim"' thinking some depency was just missing. It gave me this (different) error:

error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'shell'
         whose name attribute is located at /nix/store/9hfp0agnm43kz72l5lpfn9var5p0x2fa-source/pkgs/stdenv/generic/make-derivation.nix:541:13

       … while evaluating attribute 'buildInputs' of derivation 'shell'
         at /nix/store/9hfp0agnm43kz72l5lpfn9var5p0x2fa-source/pkgs/stdenv/generic/make-derivation.nix:593:13:
          592|             depsHostHost = elemAt (elemAt dependencies 1) 0;
          593|             buildInputs = elemAt (elemAt dependencies 1) 1;
             |             ^
          594|             depsTargetTarget = elemAt (elemAt dependencies 2) 0;

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: Dependency is not of a valid type: element 2 of buildInputs for shell

At this point, i didn’t understood what was wrong so i wanted to try the second command i got in the guide.
So i placed my self in /nixpkgs/pkgs/applications/editors/vim/plugins and runned ./utils/update.py add "jannis-baum/vivify.vim"
I get this error:

Traceback (most recent call last):
  File "/home/tomasr/pkgs/nixpkgs/pkgs/applications/editors/vim/plugins/./utils/update.py", line 33, in <module>
    import nixpkgs_plugin_update
ModuleNotFoundError: No module named 'nixpkgs_plugin_update'

I think it’s probably misssing some dependecy:
so i run nix-shell -p vimPluginsUpdater vimUtils --run './utils/update.py add "jannis-baum/vivify.vim"' thinking the solution was just to add the same depencies as before. It gave me:

error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'shell'
         whose name attribute is located at /nix/store/9hfp0agnm43kz72l5lpfn9var5p0x2fa-source/pkgs/stdenv/generic/make-derivation.nix:541:13

       … while evaluating attribute 'buildInputs' of derivation 'shell'
         at /nix/store/9hfp0agnm43kz72l5lpfn9var5p0x2fa-source/pkgs/stdenv/generic/make-derivation.nix:593:13:
          592|             depsHostHost = elemAt (elemAt dependencies 1) 0;
          593|             buildInputs = elemAt (elemAt dependencies 1) 1;
             |             ^
          594|             depsTargetTarget = elemAt (elemAt dependencies 2) 0;

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: Dependency is not of a valid type: element 2 of buildInputs for shell

At this point i encountered the same error as before and did not knew what to do next.

So please, could someone help me? :pleading_face:

When i get this going, i just should open a pull request to nixpkgs? or something else?
and how could i use the plugin between the time i do the pull request and the time it is accepted?

1 Like

This is a sticky one! Looks like vimPlugins: update on 2026-01-16 by khaneliman · Pull Request #480746 · NixOS/nixpkgs · GitHub changed the interface between the updater utility and the generated .nix file, so I expect you’re on 25.11 and running what amounts to an older version of the update tool. Not your fault!

When you run nix-shell -p vimPluginsUpdater (from the root of your Nixpkgs working directory, not from the plugins directory), insert -I nixpkgs=$PWD. That should get you using the current thing.

As a tip, you might want to start with your Git worktree on the latest nixpkgs-unstable, and then rebase to master before submitting your PR. That should ensure that any dependencies the updater tool has will be fetched from the cache instead of built on your machine, saving you some time.

1 Like

Thank you. :folded_hands:

In conjonction with this blog post (TIL: How to Add New Vim Plugins to nixpkgs Repository | Haseeb Majid) i was able to do it. See vimPlugins.vivify-vim: init at 0-unstable-2025-08-08 by Totorile1 · Pull Request #505240 · NixOS/nixpkgs · GitHub.

Now this might be a dumb question, but is there a way to start using this package before it is put into nixpkgs-unstable?

Not a dumb question! The simplest thing you can do is to copy the definition of vivify-vim from your PR and paste it into your configuration. If you’ve been following the manual, then do what it says in this section, replacing the attribute set passed to pkgs.vimUtils.buildVimPlugin with the contents of buildVimPlugin from your PR. (You’ll also need to prefix fetchFromGitHub with pkgs. when you do that, most likely.)

1 Like