-
Notifications
You must be signed in to change notification settings - Fork 26
/
default.nix
58 lines (45 loc) · 1.18 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ pkgs ? import <nixpkgs> {} }:
let
inherit (pkgs) stdenv fetchFromGitHub writeText vim;
vader = fetchFromGitHub {
owner = "junegunn";
repo = "vader.vim";
rev = "ddb714246535e814ddd7c62b86ca07ffbec8a0af";
sha256 = "0jlxbp883y84nal5p55fxg7a3wqh3zny9dhsvfjajrzvazmiz44n";
};
in
stdenv.mkDerivation rec {
name = "vim-nix-${version}${versionSuffix}";
version = "0.1.0";
versionSuffix = "pre${toString src.revCount or 0}.${src.shortRev or "0000000"}";
src = ./.;
dontBuild = true;
preferLocalBuild = true;
buildInputs = [ vim ];
installPhase = ''
mkdir -p $out
cp -r ftdetect ftplugin indent syntax $out
'';
vimrc = writeText "vimrc" ''
filetype off
set rtp^=${vader}
set rtp^=${src}
filetype plugin indent on
syntax enable
function! Syntax()
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunction
command! Syntax call Syntax()
set backspace=2
set hlsearch
'';
checkPhase = ''
( vim -XNu ${vimrc} -i NONE -c 'Vader! test/*.vader' ) |& tee vim-nix-test.log >&2
'';
doCheck = true;
shellHook = ''
vim() {
command vim -XNu ${vimrc} -i NONE "$@"
}
'';
}