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

automatically add dependencies for vim plugins with a *.rockspec #160484

Closed
wants to merge 3 commits into from

Conversation

teto
Copy link
Member

@teto teto commented Feb 17, 2022

Motivation for this change

Thee are many neovim plugins that are written in lua, compared to vimscript, it favors using external dependencies (well mostly plenary or nvim-treesitter for now).
This is an attempt to leverage *.rockspec files in these vim plugins to autodeduce dependencies, this updates the vim update plugin so that:
1/ it looks for a rockspec in the source of the plugin
2/ if it detects one, it generates the lua derivation via luarocks2nix
3/ it generates the vim plugin derivation as usual but inherits buildInputs/meta from the lua derivation.

Right now, I've separated the lua plugins from the traditional system to ease updates. One question is if we should instead move these plugins to the luaPackages to maintainers/scripts/luarocks-packages.csv

I use this command to update the lua-generated.nix

./pkgs/misc/vim-plugins/update.py --proc=10 --debug DEBUG --input-names ./pkgs/misc/vim-plugins/lua-plugin-names --out ./pkgs/misc/vim-plugins/lua-generated.nix

NB: there is some effort to define a (neo)vim plugin format https://github.com/nvim-lua/nvim-package-specification . For now I've added rockspecs to several plugins not sure how it's going to evolve.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

teto added 3 commits April 1, 2022 04:02
plan is to check for rockspec in store path, if yes, call luarocks2nix
to get dependencies

TODO need to fix luarocks-nix to work with local rockspecs

luarocks-nix: bumped version

cleanup

./pkgs/misc/vim-plugins/update.py --proc=10 --debug DEBUG --input-names ./pkgs/misc/vim-plugins/lua-plugin-names

TODO run luarocks on store path instead

1 plugins were checked
Checking for rockspec
TOTO
Found a rockspec !
/nix/store/a1ph5kd6gjzgy8vvpvzbnlaha9i4khvd-4a2d30f5fb77750c7a42be9bb58a9cc2c6c7f31d.tar.gz/gitsigns.nvim-scm-1.rockspec
ran cmd: ['luarocks', 'nix', 'gitsigns.nvim']
can't find suitable rock gitsigns.nvim

adding file

wip
 pkgs/applications/editors/vim/plugins/update.py --github-token=$GITHUB_TOKEN --input-names pkgs/applications/editors/vim/plugins/lua-plugin-names
@teto
Copy link
Member Author

teto commented Jun 18, 2022

this was not upstreamable. Much better approach at #178180

@teto teto closed this Jun 18, 2022
@teto teto deleted the lua-plugins-autodeps branch December 31, 2023 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant