1
0

default.nix 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. rm -r $out/queries/svelte
  20. mkdir $out/plugin
  21. cp plugin/query_predicates.lua $out/plugin
  22. mkdir -p $out/lua/nvim-treesitter
  23. cp lua/nvim-treesitter/indent.lua $out/lua/nvim-treesitter
  24. '';
  25. };
  26. "nvim-treesitter/nvim-treesitter-context" = {
  27. postInstall = ''
  28. rm -r $out/queries/svelte
  29. '';
  30. };
  31. "FourierTransformer/tinytoml" = {
  32. postPatch = ''
  33. mkdir lua
  34. mv tinytoml.lua lua
  35. '';
  36. };
  37. };
  38. buildPlugin = name: spec:
  39. let
  40. nameParts = builtins.split "/" name;
  41. owner = builtins.head nameParts;
  42. repo = builtins.elemAt nameParts 2;
  43. in
  44. buildNeovimPlugin ({
  45. name = repo;
  46. src = fetchFromGitHub {
  47. inherit owner repo;
  48. inherit (spec) rev sha256;
  49. };
  50. passthru = {
  51. optional = spec.optional or false;
  52. };
  53. dontBuild = true;
  54. } // (overrides.${name} or {}));
  55. in
  56. builtins.mapAttrs buildPlugin plugins