1
0

default.nix 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. patches = [
  10. # these extra rules causes nvim to crash when looking at a deeply nested
  11. # JSX expression
  12. ./treesitter-jsx.patch
  13. # try to fix indentation in JS
  14. ./treesitter-ecma.patch
  15. ];
  16. installPhase = ''
  17. mkdir $out
  18. cp -r runtime/queries $out/queries
  19. mkdir $out/plugin
  20. cp plugin/query_predicates.lua $out/plugin
  21. mkdir -p $out/lua/nvim-treesitter
  22. cp lua/nvim-treesitter/indent.lua $out/lua/nvim-treesitter
  23. '';
  24. };
  25. "FourierTransformer/tinytoml" = {
  26. postPatch = ''
  27. mkdir lua
  28. mv tinytoml.lua lua
  29. '';
  30. };
  31. };
  32. buildPlugin = name: spec:
  33. let
  34. nameParts = builtins.split "/" name;
  35. owner = builtins.head nameParts;
  36. repo = builtins.elemAt nameParts 2;
  37. in
  38. buildNeovimPlugin ({
  39. name = repo;
  40. src = fetchFromGitHub {
  41. inherit owner repo;
  42. inherit (spec) rev sha256;
  43. };
  44. passthru = {
  45. optional = spec.optional or false;
  46. };
  47. dontBuild = true;
  48. } // (overrides.${name} or {}));
  49. in
  50. builtins.mapAttrs buildPlugin plugins