about summary refs log tree commit diff
path: root/modules/user
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-12-07 22:05:55 +0100
committeraszlig <aszlig@redmoonstudios.org>2015-12-07 22:05:55 +0100
commit5254bf53525dfc5e42dea199bc37ed094faed1da (patch)
tree715ea634f2117ec726352d79f846fdb46d931c80 /modules/user
parent3bf7b0dc9d087d7c141f317456e7abdd60ceda2a (diff)
programs/vim: Combine vim-addon-nix with vim-nix.
I want to have the syntax highlighting and indentation rules of @LnL7's
vim-nix (https://github.com/LnL7/vim-nix) - or more exactly my pull
request overhauling the syntax highlighting file (LnL7/vim-nix#1) -
while having everything else from @MarcWeber's vim-addon-nix
(https://github.com/MarcWeber/vim-addon-nix).

At least until both projects hopefully merge :-D

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules/user')
-rw-r--r--modules/user/aszlig/programs/vim/default.nix38
1 files changed, 33 insertions, 5 deletions
diff --git a/modules/user/aszlig/programs/vim/default.nix b/modules/user/aszlig/programs/vim/default.nix
index 6a09fead..50483ebd 100644
--- a/modules/user/aszlig/programs/vim/default.nix
+++ b/modules/user/aszlig/programs/vim/default.nix
@@ -190,11 +190,39 @@ let
       type = "indent";
     };
 
-    nixAddon = pkgs.fetchFromGitHub {
-      owner = "MarcWeber";
-      repo = "vim-addon-nix";
-      rev = "2aed79ba5d8c5e6abd102de77e55e242f61b17f1";
-      sha256 = "0zx1q9994py6jmm0qbbx6fc1dy5la8zfskkbvqqxssxrl5dx7vvi";
+    nixAddon = pkgs.stdenv.mkDerivation {
+      name = "vim-nix-support";
+
+      lnl7 = pkgs.fetchFromGitHub {
+        owner = "LnL7";
+        repo = "vim-nix";
+        rev = "75e965cf6e1b1428f2dce5130d9e7e492ecc92d8";
+        sha256 = "0mwy407q00py80zqfgl60004bi4xicz1qlqw0cfzdqs8mcp5s1fl";
+      };
+
+      src = pkgs.fetchFromGitHub {
+        owner = "MarcWeber";
+        repo = "vim-addon-nix";
+        rev = "2aed79ba5d8c5e6abd102de77e55e242f61b17f1";
+        sha256 = "0zx1q9994py6jmm0qbbx6fc1dy5la8zfskkbvqqxssxrl5dx7vvi";
+      };
+
+      phases = [ "unpackPhase" "patchPhase" "installPhase" ];
+      patchPhase = ''
+        for what in indent syntax; do
+          install -vD -m 0644 "$lnl7/$what/nix.vim" "$what/nix.vim"
+        done
+        sed -i -re '/^ *au(group)? /,/^ *au(group)? +end/ {
+          s/^ *au(tocmd)? +((BufRead|BufNewFile),?)+ +[^ ]+ +setl(ocal)?/${
+            "& sw=2 sts=2 et iskeyword+=-"
+          }/
+        }' plugin/vim-addon-nix.vim
+        grep '^setlocal' "$lnl7/ftplugin/nix.vim" >> ftplugin/nix.vim
+      '';
+
+      installPhase = ''
+        cp -Rd . "$out"
+      '';
     };
 
     urwebAddon = pkgs.fetchFromGitHub {