-
Notifications
You must be signed in to change notification settings - Fork 2
/
home.nix
331 lines (293 loc) · 9.18 KB
/
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
{
# FIXME: uncomment the next line if you want to reference your GitHub/GitLab access tokens and other secrets
# secrets,
config,
pkgs,
username,
nix-index-database,
...
}: let
unstable-packages = with pkgs.unstable; [
# FIXME: select your core binaries that you always want on the bleeding-edge
bat
bottom
coreutils
curl
du-dust
fd
findutils
fx
git
git-crypt
htop
jq
killall
lunarvim
mosh
neovim
procs
ripgrep
sd
tmux
tree
unzip
vim
wget
zip
];
stable-packages = with pkgs; [
# FIXME: customize these stable packages to your liking for the languages that you use
# key tools
gh # for bootstrapping
just
# core languages
rustup
go
lua
nodejs
python3
typescript
# rust stuff
cargo-cache
cargo-expand
# local dev stuf
mkcert
httpie
# treesitter
tree-sitter
# language servers
ccls # c / c++
gopls
nodePackages.typescript-language-server
pkgs.nodePackages.vscode-langservers-extracted # html, css, json, eslint
nodePackages.yaml-language-server
sumneko-lua-language-server
nil # nix
nodePackages.pyright
# formatters and linters
alejandra # nix
black # python
ruff # python
deadnix # nix
golangci-lint
lua52Packages.luacheck
nodePackages.prettier
shellcheck
shfmt
statix # nix
sqlfluff
tflint
];
in {
imports = [
nix-index-database.hmModules.nix-index
];
home.stateVersion = "22.11";
home = {
username = "${username}";
homeDirectory = "/home/${username}";
# FIXME: set your preferred $EDITOR
sessionVariables.EDITOR = "${pkgs.neovim}/bin/nvim";
# FIXME: set your preferred $SHELL
sessionVariables.SHELL = "/etc/profiles/per-user/${username}/bin/zsh";
};
home.packages =
stable-packages
++ unstable-packages
++
# FIXME: you can add anything else that doesn't fit into the above two lists in here
[
# pkgs.some-package
# pkgs.unstable.some-other-package
];
# FIXME: if you want to version your LunarVim config, add it to the root of this repo and uncomment the next line
# home.file.".config/lvim/config.lua".source = ./lvim_config.lua;
programs = {
home-manager.enable = true;
nix-index.enable = true;
nix-index.enableZshIntegration = true;
nix-index-database.comma.enable = true;
# FIXME: disable this if you don't want to use the starship prompt
starship.enable = true;
starship.settings = {
aws.disabled = true;
gcloud.disabled = true;
kubernetes.disabled = false;
git_branch.style = "242";
directory.style = "blue";
directory.truncate_to_repo = false;
directory.truncation_length = 8;
python.disabled = true;
ruby.disabled = true;
hostname.ssh_only = false;
hostname.style = "bold green";
};
# FIXME: disable whatever you don't want
fzf.enable = true;
fzf.enableZshIntegration = true;
lsd.enable = true;
lsd.enableAliases = true;
zoxide.enable = true;
zoxide.enableZshIntegration = true;
broot.enable = true;
broot.enableZshIntegration = true;
direnv.enable = true;
direnv.enableZshIntegration = true;
direnv.nix-direnv.enable = true;
git = {
enable = true;
package = pkgs.unstable.git;
delta.enable = true;
delta.options = {
line-numbers = true;
side-by-side = true;
navigate = true;
};
userEmail = ""; # FIXME: set your git email
userName = ""; #FIXME: set your git username
extraConfig = {
# FIXME: uncomment the next lines if you want to be able to clone private https repos
# url = {
# "https://oauth2:${secrets.github_token}@github.com" = {
# insteadOf = "https://github.com";
# };
# "https://oauth2:${secrets.gitlab_token}@gitlab.com" = {
# insteadOf = "https://gitlab.com";
# };
# };
push = {
default = "current";
autoSetupRemote = true;
};
merge = {
conflictstyle = "diff3";
};
diff = {
colorMoved = "default";
};
};
};
# FIXME: This is my .zshrc - you can fiddle with it if you want
zsh = {
enable = true;
autocd = true;
enableAutosuggestions = true;
enableCompletion = true;
defaultKeymap = "emacs";
history.size = 10000;
history.save = 10000;
history.expireDuplicatesFirst = true;
history.ignoreDups = true;
history.ignoreSpace = true;
historySubstringSearch.enable = true;
plugins = [
{
name = "fast-syntax-highlighting";
src = "${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions";
}
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "chisui";
repo = "zsh-nix-shell";
rev = "v0.5.0";
sha256 = "0za4aiwwrlawnia4f29msk822rj9bgcygw6a8a6iikiwzjjz0g91";
};
}
];
shellAliases = {
"..." = "./..";
"...." = "././..";
cd = "z";
gc = "nix-collect-garbage --delete-old";
refresh = "source ${config.home.homeDirectory}/.zshrc";
show_path = "echo $PATH | tr ':' '\n'";
# FIXME: add more git aliases here if you want them
gapa = "git add --patch";
grpa = "git reset --patch";
gst = "git status";
gdh = "git diff HEAD";
gp = "git push";
gph = "git push -u origin HEAD";
gco = "git checkout";
gcob = "git checkout -b";
gcm = "git checkout master";
gcd = "git checkout develop";
pbcopy = "/mnt/c/Windows/System32/clip.exe";
pbpaste = "/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -command 'Get-Clipboard'";
explorer = "/mnt/c/Windows/explorer.exe";
};
envExtra = ''
export PATH=$PATH:$HOME/.local/bin
'';
initExtra = ''
bindkey '^p' history-search-backward
bindkey '^n' history-search-forward
bindkey '^e' end-of-line
bindkey '^w' forward-word
bindkey "^[[3~" delete-char
bindkey ";5C" forward-word
bindkey ";5D" backward-word
zstyle ':completion:*:*:*:*:*' menu select
# Complete . and .. special directories
zstyle ':completion:*' special-dirs true
zstyle ':completion:*' list-colors ""
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
# disable named-directories autocompletion
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
# Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache"
# Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
usbmux uucp vcsa wwwrun xfs '_*'
# ... unless we really want to.
zstyle '*' single-ignored complete
# https://thevaluable.dev/zsh-completion-guide-examples/
zstyle ':completion:*' completer _extensions _complete _approximate
zstyle ':completion:*:descriptions' format '%F{green}-- %d --%f'
zstyle ':completion:*' group-name ""
zstyle ':completion:*:*:-command-:*:*' group-order alias builtins functions commands
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*' matcher-list "" 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# mkcd is equivalent to takedir
function mkcd takedir() {
mkdir -p $@ && cd ''${@:$#}
}
function takeurl() {
local data thedir
data="$(mktemp)"
curl -L "$1" > "$data"
tar xf "$data"
thedir="$(tar tf "$data" | head -n 1)"
rm "$data"
cd "$thedir"
}
function takegit() {
git clone "$1"
cd "$(basename ''${1%%.git})"
}
function take() {
if [[ $1 =~ ^(https?|ftp).*\.(tar\.(gz|bz2|xz)|tgz)$ ]]; then
takeurl "$1"
elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then
takegit "$1"
else
takedir "$@"
fi
}
WORDCHARS='*?[]~=&;!#$%^(){}<>'
# fixes duplication of commands when using tab-completion
export LANG=C.UTF-8
'';
};
};
}