-
Notifications
You must be signed in to change notification settings - Fork 1
/
home.nix
357 lines (337 loc) · 8.66 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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
{ inputs, outputs, config, pkgs, lib, ... }:
with lib;
{
imports = [
# If you want to use modules your own flake exports (from modules/home-manager):
# outputs.homeManagerModules.example
# Or modules exported from other flakes (such as nix-colors):
# inputs.nix-colors.homeManagerModules.default
# You can also split up your configuration and import pieces of it here:
# ./nvim.nix
];
nix = {
package = pkgs.nix;
checkConfig = true;
settings = {
experimental-features = [ "nix-command" "flakes" ];
use-xdg-base-directories = true;
cores = 0; # use all available cores
max-jobs = 10;
auto-optimise-store = true;
warn-dirty = false;
http-connections = 50;
trusted-users = "charles";
};
gc = {
automatic = true;
options = "--max-freed $((64 * 1024**3))";
};
};
nixpkgs = {
overlays = [
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
};
};
# Nicely reload system units when changing configs
# systemd.user.startServices = "sd-switch";
home = {
# home.username = lib.strings.removeSuffix "\n" (builtins.readFile /etc/hostname);
username = "charles";
homeDirectory = "/home/charles";
stateVersion = "24.11";
};
# https://search.nixos.org/packages?query=
# https://home-manager-options.extranix.com/?query=
home.packages = with pkgs; [
chafa
curl
git
gnupg
gnutar
gzip
hstr
unzip
vim
wget
xdg-ninja
# c/c++ cli
btop
fzy
jq
lnav
micromamba # conda replacement
# python cli
git-fame
git-filter-repo
# golang cli
fzf
glow
lazydocker
lazygit
nix-search-cli
pistol
yq-go # jq but for YAML, JSON, XML, CSV, TOML
# vfox ## TODO: https://github.com/version-fox/vfox/issues/53
# rust cli
# joshuto
# xq
bat
delta
dua
git-ignore # sondr3/git-ignore
eva
eza
fd
fh # official CLI for FlakeHub
lsd
mise
ripgrep
ripgrep-all
ripsecrets
rye # like cargo but for python
skim
sd
starship
tokei
topgrade
tree-sitter
uv # pip in rust
xh
yazi
zellij
zoxide
];
home.file = {
# ".ssh/config".source = ./conf.d/ssh/config;
".config/topgrade.toml".source = ./conf.d/topgrade/topgrade.toml;
".local/bin" = {
recursive = true;
source = ./conf.d/Usercommand;
};
};
programs.home-manager.enable = true;
xdg.enable = true;
xdg.configFile = {
# core-utils
"zsh" = {
recursive = true;
source = ./conf.d/zsh;
};
"git" = {
recursive = true;
source = ./conf.d/git;
};
# lang-vms
"mise" = {
recursive = true;
source = ./conf.d/mise;
};
"conda" = {
recursive = true;
source = ./conf.d/conda;
};
# cli-utils
"bat" = {
recursive = true;
source = ./conf.d/bat;
};
"btop" = {
recursive = true;
source = ./conf.d/btop;
};
"fd" = {
recursive = true;
source = ./conf.d/fd;
};
"glow" = {
recursive = true;
source = ./conf.d/glow;
};
"htop" = {
recursive = true;
source = ./conf.d/htop;
};
"lazygit" = {
recursive = true;
source = ./conf.d/lazygit;
};
"lsd" = {
recursive = true;
source = ./conf.d/lsd;
};
"npm" = {
recursive = true;
source = ./conf.d/npm;
};
"pistol" = {
recursive = true;
source = ./conf.d/pistol;
};
"starship" = {
recursive = true;
source = ./conf.d/starship;
};
"wget" = {
recursive = true;
source = ./conf.d/wget;
};
"yarn" = {
recursive = true;
source = ./conf.d/yarn;
};
"yazi" = {
recursive = true;
source = ./conf.d/yazi;
};
"zellij" = {
recursive = true;
source = ./conf.d/zellij;
};
};
home.activation.nvimdotsActivatioinAction = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
if [ ! -d ~/.config/nvim ]; then
${pkgs.git}/bin/git clone https://github.com/CharlesChiuGit/nvimdots.lua.git ~/.config/nvim
fi
'';
programs.neovim = {
enable = true;
# package = pkgs.neovim-nightly;
withNodeJs = true;
withPython3 = true;
withRuby = false;
extraPackages = with pkgs;[
# Dependent packages used by default plugins
doq
cargo
clang
cmake
gcc
gnumake
go
ninja
pkg-config
yarn
lua51Packages.luarocks
];
extraPython3Packages = pyPkgs: with pyPkgs; [
docformatter
pynvim
];
# extraLuaPackages = luaPkgs: with luaPkgs; [
# luarocks # doesn't work, put in extraPackages
# ];
viAlias = true;
vimdiffAlias = true;
};
programs.tmux = {
enable = true;
clock24 = true;
mouse = true;
secureSocket = true;
plugins = with pkgs; [
tmuxPlugins.better-mouse-mode
tmuxPlugins.tmux-fzf # prefix + F
{
plugin = tmuxPlugins.catppuccin;
extraConfig = ''
set -g @catppuccin_flavour 'macchiato' # or frappe, macchiato, mocha
set -g @catppuccin_window_tabs_enabled on
set -g @catppuccin_host "on"
'';
}
{
# automatically saves sessions for you every 15 minutes
# `prefix+Ctrl+s` to save, `prefix+Ctrl+r` to restore
plugin = tmuxPlugins.continuum;
extraConfig = ''
set -g @continuum-save-interval '15'
set -g @continuum-restore 'off'
'';
}
{
plugin = tmuxPlugins.prefix-highlight;
extraConfig = ''
set -g @prefix_highlight_prefix_prompt 'Wait'
set -g @prefix_highlight_copy_prompt 'Copy'
set -g @prefix_highlight_sync_prompt 'Sync'
'';
}
{
# persist tmux sessions after computer restart
plugin = tmuxPlugins.resurrect;
extraConfig = ''
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-dir "$XDG_DATA_HOME/tmux/resurrect"
'';
}
{
# add zoxide and fzf support for tmux session
# `prefix + T` to open session wizard
plugin = tmuxPlugins.session-wizard;
extraConfig = ''
set -g @session-wizard 'T'
'';
}
{
plugin = tmuxPlugins.yank;
extraConfig = ''
set -g @yank_selection 'chipboard'
set -g @yank_selection_mouse 'clipboard'
set -g @custom_copy_command 'yank > #{pane_tty}'
'';
}
];
extraConfig = ''
${builtins.readFile ./conf.d/tmux/tmux.conf}
'';
};
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
zprof.enable = false;
antidote = {
enable = true;
useFriendlyNames = true;
plugins = [
# lazy-loading `kind:defer`
"Aloxaf/fzf-tab kind:defer"
"zsh-users/zsh-autosuggestions kind:defer"
"zsh-users/zsh-completions kind:fpath"
"belak/zsh-utils path:completion"
"zdharma-continuum/fast-syntax-highlighting kind:defer" # add before zsh-history-substring-search to prevent breaking
"zsh-users/zsh-history-substring-search kind:defer"
"MichaelAquilina/zsh-you-should-use kind:defer"
"QuarticCat/zsh-smartcache" # better mroth/evalcache
"unixorn/docker-helpers.zshplugin kind:defer"
"zpm-zsh/colorize kind:defer" # Colorize the output of various programs
"zpm-zsh/colors" # Enhanced colors for zsh
"MichaelAquilina/zsh-autoswitch-virtualenv kind:defer" # Auto-switch python venv, pipenv, poetry
"Freed-Wu/zsh-help" # colorize `XXX --help`
"reegnz/jq-zsh-plugin kind:defer"
"nix-community/nix-zsh-completions kind:defer"
"fdw/yazi-zoxide-zsh" # "y {part path}"
# oh-my-zsh plugins
"getantidote/use-omz" # handle OMZ dependencies
"ohmyzsh/ohmyzsh path:lib" # load OMZ's library
"ohmyzsh/ohmyzsh path:plugins/colored-man-pages kind:defer" # load OMZ plugins
"ohmyzsh/ohmyzsh path:plugins/magic-enter kind:defer"
];
};
initExtra = ''
${builtins.readFile ./conf.d/zsh/setopt.zsh}
${builtins.readFile ./conf.d/zsh/exports.zsh}
${builtins.readFile ./conf.d/zsh/history.zsh}
${builtins.readFile ./conf.d/zsh/functions.zsh}
${builtins.readFile ./conf.d/zsh/bindkeys.zsh}
${builtins.readFile ./conf.d/zsh/history.zsh}
${builtins.readFile ./conf.d/zsh/plugins.zsh}
${builtins.readFile ./conf.d/zsh/aliases.zsh}
${builtins.readFile ./conf.d/zsh/completion.zsh}
${builtins.readFile ./conf.d/zsh/hashdirs.zsh}
'';
};
}