-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
69 lines (55 loc) · 1.52 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
59
60
61
62
63
64
65
66
67
68
69
let sources = import nix/sources.nix; in
{ pkgs ? import sources.nixpkgs {}
# Automatically set to `true` when using this configuration with `nix-shell`
, inNixShell ? false
# Adding “vim” and “nvim” to nix-shell for running tests
, withVim ? true
, withNeovim ? true
}:
let
thisRepoSource =
pkgs.nix-gitignore.gitignoreRecursiveSource [ ./.gitignore ] ./.;
haskell-with-unicode = pkgs.vimUtils.buildVimPlugin rec {
pname = "haskell-with-unicode.vim";
name = pname;
src = thisRepoSource;
};
# WARNING! Changes in this configuration may take effect on whether the tests
# will pass or fail.
vimRC = ''
set nocompatible
" Use spaces instead of tabs for Haskell
set expandtab
" Common indentation size for Haskell
set tabstop=2
set shiftwidth=2
syntax on
filetype plugin indent on
'';
vim = pkgs.vim_configurable.customize {
vimrcConfig = {
packages.myPlugins.start = [ haskell-with-unicode ];
customRC = vimRC;
};
};
neovim = pkgs.neovim.override {
configure = {
packages.myPlugins.start = [ haskell-with-unicode ];
customRC = vimRC;
};
};
shell = pkgs.mkShell {
buildInputs = [
# Some dependencies for scripts (e.g. tests running script) to work
pkgs.bash
pkgs.coreutils
pkgs.diffutils
vim
neovim
] ++ pkgs.lib.optional withVim vim
++ pkgs.lib.optional withNeovim neovim;
};
in
(if inNixShell then shell else {}) // {
inherit shell vim neovim haskell-with-unicode;
}