-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
282 lines (274 loc) · 8.33 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
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
{ config, pkgs, lib, ... }: {
imports = [
./neovim.nix
./tmux.nix
];
home = {
file = {
"${config.xdg.configHome}/neofetch/config.conf".text = builtins.readFile ./neofetch.conf;
};
# A Modern Unix experience
# https://jvns.ca/blog/2022/04/12/a-list-of-new-ish--command-line-tools/
packages = with pkgs; [
asciinema # Terminal recorder
breezy # Terminal bzr client
chafa # Terminal image viewer
dconf2nix # Nix code from Dconf files
diffr # Modern Unix `diff`
difftastic # Modern Unix `diff`
dua # Modern Unix `du`
duf # Modern Unix `df`
du-dust # Modern Unix `du`
entr # Modern Unix `watch`
fd # Modern Unix `find`
ffmpeg-headless # Terminal video encoder
fzf # Command-line fuzzy finder
glow # Terminal Markdown renderer
gping # Modern Unix `ping`
hexyl # Modern Unix `hexedit`
hyperfine # Terminal benchmarking
jpegoptim # Terminal JPEG optimizer
jiq # Modern Unix `jq`
lazygit # Terminal Git client
neofetch # Terminal system info
nixpkgs-review # Nix code review
nurl # Nix URL fetcher
nyancat # Terminal rainbow spewing feline
optipng # Terminal PNG optimizer
page # Modern pager
procs # Modern Unix `ps`
quilt # Terminal patch manager
ripgrep # Modern Unix `grep`
tldr # Modern Unix `man`
tokei # Modern Unix `wc` for code
wget # Terminal downloader
yq-go # Terminal `jq` for YAML
];
sessionVariables = {
EDITOR = "nvim";
PAGER = "less";
SYSTEMD_EDITOR = "nvim";
VISUAL = "nvim";
};
};
oxc.console.atuin.enable = lib.mkDefault true;
programs = {
bottom = {
enable = true;
settings = {
colors = {
high_battery_color = "green";
medium_battery_color = "yellow";
low_battery_color = "red";
};
disk_filter = {
is_list_ignored = true;
list = [ "/dev/loop" ];
regex = true;
case_sensitive = false;
whole_word = false;
};
flags = {
dot_marker = false;
enable_gpu_memory = true;
group_processes = true;
hide_table_gap = true;
mem_as_value = true;
tree = true;
};
};
};
dircolors = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
};
direnv = {
enable = true;
enableBashIntegration = true;
nix-direnv = {
enable = true;
};
};
eza = {
enable = true;
enableFishIntegration = true;
icons = "auto";
};
fish = {
enable = true;
shellAliases = {
diff = "diffr";
glow = "glow --pager";
htop = "btm --basic --tree --hide_table_gap --dot_marker --mem_as_value";
ip = "ip --color --brief";
top = "btm --basic --tree --hide_table_gap --dot_marker --mem_as_value";
tree = "eza --tree";
};
functions =
let
doCurl = type: url: "$(curl -L \"${url}\" 2>/dev/null | ${type}sum | awk '{print $1}')";
makeSriHasher = type: content: "nix-hash --type ${type} --to-sri ${content}";
makeSriUrlHasher = url: type: makeSriHasher type (doCurl type url);
makeSriUrlHasherFishFunction = makeSriUrlHasher "$argv[1]";
in
{
dev = ''
if [ -d $HOME/0xc/nixcfg ]
nix develop $HOME/0xc/nixcfg#$argv[1]
else
nix develop github:( \
git remote -v \
| grep '(push)' \
| awk '{print $2}' \
| cut -d ':' -f 2 \
| rev \
| sed 's/tig.//' \
| rev \
)#$argv[1];
end
'';
is-number = ''
string match --quiet --regex "^\d+\$" $argv[1]
'';
deploy-nuc = "is-number $argv[1] && nixos-rebuild --fast --flake $HOME/0xc/nixcfg#nuc$argv[1] --target-host [email protected]$argv[1] $argv[2..]";
sriMd5Url = makeSriUrlHasherFishFunction "md5";
sriSha1Url = makeSriUrlHasherFishFunction "sha1";
sriSha256Url = makeSriUrlHasherFishFunction "sha256";
sriSha512Url = makeSriUrlHasherFishFunction "sha512";
};
plugins = with pkgs.fishPlugins; [
{ name = "foreign-env"; inherit (foreign-env) src; }
{ name = "fzf"; inherit (fzf-fish) src; }
];
};
gh = {
enable = true;
extensions = with pkgs; [ gh-markdown-preview ];
settings = {
editor = "nvim";
git_protocol = "ssh";
prompt = "enabled";
};
};
git = {
enable = true;
delta = {
enable = false;
# enable = true;
# options = {
# features = "decorations";
# navigate = true;
# line-numbers = true;
# side-by-side = true;
# syntax-theme = "GitHub";
# };
};
aliases = {
lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
a = "add";
f = "fetch";
p = "push";
co = "checkout";
cm = "commit";
st = "status";
br = "branch";
rs = "reset";
rb = "rebase";
rbc = "rebase --continue";
d = "diff";
ds = "d --staged";
# branch name
bn = "br --show-current";
# gets root directory
rd = "rev-parse --show-toplevel";
# gets latest shared commit
sr = "merge-base HEAD";
aa = "!git a $(git rd)";
rsa = "!git rs $(git rd)";
fa = "f --all";
# shows commit history
hist = "log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short";
# amend
am = "!git cm --amend --no-edit --date=\"$(date +'%Y %D')\"";
# push to origin HEAD
poh = "p origin HEAD";
# push remote branch- defaults to 'origin' but can accept a remote name
prb = "!gitprb() { local remote=\"$1\"; test -z \"$remote\" && remote=\"$(git cdr)\"; test -z \"$remote\" && remote=\"origin\"; test -n \"$remote\" && git p $remote $(git bn); }; gitprb";
# force with lease, please, if you would
pf = "!git prb $(git cdr || echo -n 'origin') --force-with-lease";
# FORCEEEE
pff = "!git prb $(git cdr || echo -n 'origin') --force";
# push and open pr
ppr = "!git poh; !git pr";
# open pr
pr = "!gh pr create";
# squash it
sq = "!gitsq() { git rb -i $(git sr $1) $2; }; gitsq";
# generate patch
gp = "!gitgenpatch() { target=$1; git format-patch $target --stdout | sed -n -e '/^diff --git/,$p' | head -n -3; }; gitgenpatch";
cob = "co -b";
rh = "rs --hard";
rho = "!git rh origin/$(git bn)";
# default remote configurations
sdr = "config checkout.defaultRemote";
cdr = "!gitcdr() { git config --get checkout.defaultRemote || printf 'origin' ; }; gitcdr";
# short-hands for ignoring and unignoring files without .gitignore
ignore = "update-index --assume-unchanged";
ig = "ignore";
unignore = "update-index --no-assume-unchanged";
unig = "unignore";
ignored = "!git ls-files -v | grep \"^[[:lower:]]\"";
ls-ig = "ignored";
};
extraConfig = {
push = {
default = "matching";
};
pull = {
rebase = true;
ff = "only";
};
init = {
defaultBranch = "main";
};
};
ignores = [
"*.log"
"*.out"
".DS_Store"
"bin/"
"dist/"
"result"
];
};
gpg.enable = true;
home-manager.enable = true;
info.enable = true;
jq.enable = true;
micro = {
enable = true;
settings = {
colorscheme = "simple";
diffgutter = true;
rmtrailingws = true;
savecursor = true;
saveundo = true;
scrollbar = true;
};
};
powerline-go = {
enable = true;
settings = {
cwd-max-depth = 5;
cwd-max-dir-size = 12;
max-width = 60;
};
};
zoxide = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
};
};
}