-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnick-home.nix
191 lines (161 loc) · 4.35 KB
/
nick-home.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
{ config, pkgs, inputs, ... }:
{
imports = [ ./nick-work.nix ];
home = {
stateVersion = "22.05";
file.".zshrc" = {
text = ''
export POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status os_icon)
export POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
unsetopt share_history
eval "$(direnv hook zsh)"
'';
};
file.".config/nixpkgs/config.nix" = {
text = ''
{ allowUnfree = true; }
'';
};
packages = [ pkgs.direnv ];
};
programs.bash = {
enable = true;
enableVteIntegration = true;
initExtra = ''
# hook direnv
eval "$(direnv hook bash)"
# nix porcelain customizations
function nsd() {
case $# in
1)
nix derivation show "$1" | jq -C . | bat
;;
2)
nix derivation show "$1" | jq -C .\""$1"\"."$2" | bat
;;
*)
echo "nsd: don't know what to do with $@"
;;
esac
}
export -f nsd
'';
};
programs.direnv = {
enable = true;
# stolen from evanjs:
# https://github.com/evanjs/nixos_cfg/blob/master/config/new-modules/console.nix#L72
stdlib = ''
layout_poetry() {
if [[ ! -f pyproject.toml ]]; then
log_error 'No pyproject.toml found. Use `poetry new` or `poetry init` to create one first.'
exit 2
fi
# create venv if it doesn't exist
poetry run true
export VIRTUAL_ENV=$(poetry env info --path)
export POETRY_ACTIVE=1
PATH_add "$VIRTUAL_ENV/bin"
}
'';
};
programs.neovim = {
enable = true;
package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default;
viAlias = true;
vimAlias = true;
coc = {
enable = false;
# See https://github.com/nix-community/home-manager/issues/2966
package = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "coc.nvim";
version = "0.0.82"; # 2024-07-14
src = pkgs.fetchFromGitHub {
owner = "neoclide";
repo = "coc.nvim";
rev = "ebe2a2058ed85d3884f8010a53bac25edbf9675c";
sha256 = "sha256-vXZEzWxU7uNkRnBoB9OUn3if7jzRbvdJxWfhf8QPans=";
};
meta.homepage = "https://github.com/neoclide/coc.nvim/";
};
pluginConfig = ''
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
" Insert <tab> when previous text is space, refresh completion if not.
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1):
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
'';
settings = {
"java.trace.server"= "verbose";
"java.configuration.runtimes" = with pkgs; [
{ name = "JDK8";
path = "${openjdk8}/lib/openjdk";
}
{ name = "JDK11";
path = "${openjdk11}/lib/openjdk";
}
{ name = "JDK17";
path = "${openjdk17}/lib/openjdk";
default = true;
}
];
};
};
withNodeJs = true; # tmp https://github.com/nix-community/home-manager/pull/3048
plugins = with pkgs.vimPlugins; [
coc-java
coc-json
# coc-rls
jsonc-vim
(nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars))
vim-plugin-AnsiEsc
vim-nix
];
};
programs.git = {
enable = true;
lfs.enable = true;
userName = "Nick Bathum";
userEmail = "[email protected]";
signing = {
key = "04197E06F68C4DA2F45DC12E6F47A049DC3446FB";
signByDefault = true;
};
difftastic = {
enable = true;
color = "always";
};
includes = [
{
condition = "gitdir:~/work/rjg/";
contents = {
user = {
email = "[email protected]";
};
};
}
];
extraConfig = {
init.defaultBranch = "main";
};
};
programs.ssh = {
enable = true;
matchBlocks = {
"bitbucket.org" = {
identityFile = "~/.ssh/rsa_ncataria";
};
"github.com" = {
identityFile = "~/.ssh/rsa_ncataria";
};
"gitlab.com" = {
identityFile = "~/.ssh/rsa_ncataria";
};
};
};
}