From 5254bf53525dfc5e42dea199bc37ed094faed1da Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 7 Dec 2015 22:05:55 +0100 Subject: 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 --- modules/user/aszlig/programs/vim/default.nix | 38 ++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'modules/user') 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 { -- cgit 1.4.1