default.nix 913 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. { fetchFromGitHub, fetchpatch, buildNeovimPlugin }:
  2. let
  3. plugins = builtins.fromJSON (builtins.readFile ./sources.json);
  4. overrides = {
  5. "nvim-telescope/telescope-fzf-native.nvim" = {
  6. dontBuild = false;
  7. };
  8. "nvim-treesitter/nvim-treesitter" = {
  9. # these extra rules causes nvim to crash when looking at a deeply nested
  10. # JSX expression
  11. patches = [ ./treesitter-jsx.patch ];
  12. };
  13. };
  14. buildPlugin = name: spec:
  15. let
  16. nameParts = builtins.split "/" name;
  17. owner = builtins.head nameParts;
  18. repo = builtins.elemAt nameParts 2;
  19. in
  20. buildNeovimPlugin ({
  21. name = repo;
  22. src = fetchFromGitHub {
  23. inherit owner repo;
  24. inherit (spec) rev sha256;
  25. };
  26. passthru = {
  27. optional = spec.optional or false;
  28. };
  29. dontBuild = true;
  30. } // (overrides.${name} or {}));
  31. in
  32. builtins.mapAttrs buildPlugin plugins