浏览代码

nixpkgs/neovim: build help tags

Thomas Dy 2 年之前
父节点
当前提交
e1284aae0d
共有 3 个文件被更改,包括 56 次插入120 次删除
  1. 13 1
      .config/nixpkgs/neovim/neovim.nix
  2. 41 113
      .config/nixpkgs/neovim/plugins.nix
  3. 2 6
      .config/nixpkgs/neovim/update.sh

+ 13 - 1
.config/nixpkgs/neovim/neovim.nix

@@ -2,6 +2,7 @@
 , stdenv
 , writeTextFile
 , neovim
+, neovim-unwrapped
 , fd
 , ripgrep
 , nodePackages
@@ -11,7 +12,18 @@
 , withPlayground ? false
 }:
 let
-  plugins = import ./plugins.nix { inherit stdenv fetchFromGitHub; };
+  buildNeovimPlugin = attrs: stdenv.mkDerivation ({
+    forceShare= [ "man" "info" ];
+
+    installPhase = ''
+      cp -r . $out
+
+      if [ -d "$out/doc" ]; then
+        ${neovim-unwrapped}/bin/nvim -N -u NONE -i NONE -n -E -s -V1 -c "helptags $out/doc" +quit!
+      fi
+    '';
+  } // attrs);
+  plugins = import ./plugins.nix { inherit buildNeovimPlugin fetchFromGitHub; };
   extra-treesitter-textobjects = writeTextFile {
     name = "extra-treesitter-textobjects";
     destination = "/after/queries/javascript/textobjects.scm";

+ 41 - 113
.config/nixpkgs/neovim/plugins.nix

@@ -1,22 +1,18 @@
-{ stdenv, fetchFromGitHub }:
+{ buildNeovimPlugin, fetchFromGitHub }:
 
 [
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "vim-sensible";
     src = fetchFromGitHub {
       owner = "tpope";
       repo = "vim-sensible";
-      rev = "226203be173bf0b95ee2a5cb6575ae604b3f9f7a";
-      sha256 = "0hi64zsg2acrmzshmvrmgjqd7wjgghpggw0rmjx8kd7vwcmwvfcl";
+      rev = "8985da7669bbd73afce85ef0e4a3e1ce2e488595";
+      sha256 = "15pvhbk7hkf3z7zsv1bqizqmiw75nvckf3j6njckj5ijx6kzjsnj";
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "vim-sleuth";
     src = fetchFromGitHub {
       owner = "tpope";
@@ -26,27 +22,19 @@
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "vim-fugitive";
     src = fetchFromGitHub {
       owner = "tpope";
       repo = "vim-fugitive";
-      rev = "66a921bbe38bea19f6b581c8a56d5a8a41209e35";
-      sha256 = "0p2hs22y0h1cbhiwhadci4n2vj5h1nsh9hasy3jxzx38s8kksbzl";
+      rev = "b411b753f805b969cca856e2ae51fdbab49880df";
+      sha256 = "0bcq71hfy08q4lq83rcrwpg7jkq0aszcbaqnjhphvg8wja5q30dm";
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "vim-rhubarb";
     src = fetchFromGitHub {
       owner = "tpope";
@@ -56,12 +44,8 @@
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "vim-surround";
     src = fetchFromGitHub {
       owner = "tpope";
@@ -71,12 +55,8 @@
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "vim-abolish";
     src = fetchFromGitHub {
       owner = "tpope";
@@ -86,12 +66,8 @@
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "undotree";
     src = fetchFromGitHub {
       owner = "mbbill";
@@ -101,117 +77,85 @@
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "telescope.nvim";
     src = fetchFromGitHub {
       owner = "nvim-telescope";
       repo = "telescope.nvim";
-      rev = "75a5e5065376d9103fc4bafc3ae6327304cee6e9";
-      sha256 = "1dkh69kwyjmksbl1hi33mik1wf2cljmkaq0h1imk075x26l1zym2";
+      rev = "b923665e64380e97294af09117e50266c20c71c7";
+      sha256 = "0iwlmr94kdr1xwsn2l7ryxx7x1cicpbk86flxzza6877dmig226w";
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "telescope-fzf-native.nvim";
     src = fetchFromGitHub {
       owner = "nvim-telescope";
       repo = "telescope-fzf-native.nvim";
-      rev = "6a33ecefa9b3d9ade654f9a7a6396a00c3758ca6";
-      sha256 = "1ssznk16fhnqsp2kwff48ccbrgw2cbaxjhbj6wzap9cbw78kxpf9";
+      rev = "6791f74e9f08a9412c43dcba805ecf2f8888bdde";
+      sha256 = "1fl4k6r71zgqx57hilf92zfjvqdb9znnxd0ymx68b9kqr66bwidx";
     };
 
     dontBuild = false;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "plenary.nvim";
     src = fetchFromGitHub {
       owner = "nvim-lua";
       repo = "plenary.nvim";
-      rev = "31807eef4ed574854b8a53ae40ea3292033a78ea";
-      sha256 = "1vkyqrk0shpc076rq1s7rwldmcmw2k96hcpifligrsplr170kkhv";
+      rev = "a3dafaa937921a4eb2ae65820c3479ab561e9ba3";
+      sha256 = "0n90xnxi6nrwqkkay94j2h3mcbayscmdrxa3qzpiygfsq5dqbjz5";
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "mini.nvim";
     src = fetchFromGitHub {
       owner = "echasnovski";
       repo = "mini.nvim";
-      rev = "55618446b0bb4d3ed37ff7f9f8cf6db56d34e139";
-      sha256 = "0b1kqmdkgy3kdx3gbbs3vqbkbl92jxcmyz8hin0z2vryiynpimxb";
+      rev = "085baefa6aca44526be621b15e7b688f996c2daf";
+      sha256 = "1p7an177rzv7655rw7mkmblrp1vnx983pnlqbcxciz9308b1ys74";
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "gitsigns.nvim";
     src = fetchFromGitHub {
       owner = "lewis6991";
       repo = "gitsigns.nvim";
-      rev = "9c3ca027661136a618c82275427746e481c84a4e";
-      sha256 = "089nqxs54x5bi55zkdynln32xvq9jfadlp95l85dal6c5nmn7yyi";
+      rev = "1e107c91c0c5e3ae72c37df8ffdd50f87fb3ebfa";
+      sha256 = "0qg2y796mkkisyab6br4p0d6blx8ispglpphpdlmf14hp9si56bp";
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "nvim-lspconfig";
     src = fetchFromGitHub {
       owner = "neovim";
       repo = "nvim-lspconfig";
-      rev = "06744ba3783ce2d502838f988dec95378543f5d7";
-      sha256 = "1hlwxm97wri9w40m1d90j9spzs29mi5xjr7iw86dvhhs2pa8xln4";
+      rev = "df17834baeba1b8425c15a31cbf52e6b23115c37";
+      sha256 = "1jc9grkiwczx0p4yyckjbcsz5kg3qldgi1g3fw8zlbpa2zspajb0";
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "nvim-treesitter-textobjects";
     src = fetchFromGitHub {
       owner = "nvim-treesitter";
       repo = "nvim-treesitter-textobjects";
-      rev = "b8df8b07b4ec2fea8af606004c952b1881402b1e";
-      sha256 = "03hrhwsn97229fxd3yxkcgfpcjf0s6agg4kbaxrcw36w181wx53s";
+      rev = "6dcd228384be6fa95199db57cccf27dbd4c743a5";
+      sha256 = "0l2l7r4kl2j9mvjiij419hdpghv410d5jqfqrp52l74vw703j294";
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "typescript.nvim";
     src = fetchFromGitHub {
       owner = "jose-elias-alvarez";
@@ -221,27 +165,19 @@
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "null-ls.nvim";
     src = fetchFromGitHub {
       owner = "jose-elias-alvarez";
       repo = "null-ls.nvim";
-      rev = "4f9fd416ef682121ebc9e7e5d5fc3f319aa5e64f";
-      sha256 = "1hy7gpvij2lvqm65sn4yi9w6b1zw61nnsagv3yvcal6y38f44231";
+      rev = "de751688c991216f0d17ced7d5076e0c37fa383f";
+      sha256 = "0pqhaai1zrq76la1ys21w89yjfpbb3w5b987jx50j4ip78nk572r";
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "fidget.nvim";
     src = fetchFromGitHub {
       owner = "j-hui";
@@ -251,24 +187,16 @@
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "sonokai";
     src = fetchFromGitHub {
       owner = "sainnhe";
       repo = "sonokai";
-      rev = "106c0a19e30aa3544aad760bc8c1bd552d62326c";
-      sha256 = "0r08ybpivaqlpxwgzmi2yl7q172h5y7cfrhf7rjq4w309n1yhhf3";
+      rev = "17b5a8e085c13b650dc34c3b81b27374b5ea1439";
+      sha256 = "0ssmn8lr4mgi8wcckaym3qnjg3m3l67a5avbsc3yj6igavv7c7mb";
     };
 
     dontBuild = true;
-
-    installPhase = ''
-      cp -r . $out
-    '';
   })
 ]

+ 2 - 6
.config/nixpkgs/neovim/update.sh

@@ -11,7 +11,7 @@ add_plugin() {
   sha256=$(nix-prefetch-url --unpack "https://github.com/$owner/$repo/archive/$revision.tar.gz")
 
   cat <<EOF
-  (stdenv.mkDerivation {
+  (buildNeovimPlugin {
     name = "$repo";
     src = fetchFromGitHub {
       owner = "$owner";
@@ -21,15 +21,11 @@ add_plugin() {
     };
 
     dontBuild = $dont_build;
-
-    installPhase = ''
-      cp -r . \$out
-    '';
   })
 EOF
 }
 
-echo "{ stdenv, fetchFromGitHub }:
+echo "{ buildNeovimPlugin, fetchFromGitHub }:
 
 ["