-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhome.nix
More file actions
592 lines (513 loc) · 13.6 KB
/
Copy pathhome.nix
File metadata and controls
592 lines (513 loc) · 13.6 KB
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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
{
# config,
lib,
pkgs,
username,
homeDirectory,
...
}: let
nixPackages = with pkgs; [
_1password-cli
_1password-gui
alejandra
asdf-vm
bats
claude-code
cloud-nuke
codex
cosign
deadnix
dgoss
discord
dnsutils
dropbox
google-cloud-sdk
glab
gnumake
goss
htop
httpie
ibmcloud-cli
iosevka
jira-cli-go
jq
just
kubectl
kubevirt
nomad
opencode
openshift
packer
rclone
ruby
shellcheck
shfmt
silver-searcher
# slack
stern
toolhive
vault-bin
yamllint
yq-go
winboat
];
customPkgs = import ./pkgs/custom.nix {inherit pkgs username;};
customPackages = with customPkgs; [
fedoraHost
];
# shared settings across various programs
terminalType = "screen-256color";
terminalHistoryLimit = 100000;
in {
home.username = username;
home.homeDirectory = homeDirectory;
home.stateVersion = "23.11";
home.packages = nixPackages ++ customPackages;
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"1password"
"1password-cli"
"claude-code"
"discord"
"dropbox"
"firefox-bin"
"firefox-bin-unwrapped"
"firefox-release-bin-unwrapped"
"nomad"
"packer"
"slack"
"vault-bin"
];
# Environment variables
home.sessionVariables = {
# standard env vars
EDITOR = "nvim";
PAGER = "less -Rf";
# TERM set to `foot` is not recognized everywhere
TERM = terminalType;
# 1password
SSH_AUTH_SOCK = "$HOME/.1password/agent.sock";
OP_BIOMETRIC_UNLOCK_ENABLED = "true";
OP_PLUGIN_ALIASES_SOURCED = "1";
# Testing Farm
PYTHON_KEYRING_BACKEND = "keyring.backends.null.Keyring";
# tmt
TMT_WORKDIR_ROOT = "$HOME/.local/share/tmt";
# python requests
REQUESTS_CA_BUNDLE = "/etc/pki/tls/certs/ca-bundle.crt";
# dgoss
CONTAINER_RUNTIME = "podman";
# testing-farm CLI
TESTING_FARM_PUBLIC_IP_RESOLVE_TRIES = 10;
# Tighter watch tick makes `testing-farm watch` feel responsive.
TESTING_FARM_WATCH_TICK = 3;
};
hostConfig = {
enable = true;
xdgDesktopEntries = true;
files = [
".config/foot/foot.ini"
".config/sway/config"
".config/waybar/config"
".config/waybar/style.css"
".local/share/applications/mimeapps.list"
".mozilla/firefox/profiles.ini"
".mozilla/firefox/${username}/containers.json"
".mozilla/firefox/${username}/search.json.mozlz4"
".mozilla/firefox/${username}/user.js"
];
};
# For various final configurations
home.activation.toolboxSetup = lib.hm.dag.entryAfter ["reloadSystemd"] ''
# Only for toolbox
test -f /run/.toolboxenv || exit
# Set /var/cache/man permissions to the current user
if [ ! -e /var/cache/man ]; then
echo -e "\e[32mCreating /var/cache/man\e[0m"
/usr/bin/sudo mkdir /var/cache/man
fi
if [ -e /var/cache/man -a $(stat -c "%u" /var/cache/man) -eq 0 ]; then
echo -e "\e[32mSet permissions of /var/cache/man to $USER:$USER\e[0m"
/usr/bin/sudo chown -Rf $USER:$USER /var/cache/man
fi
'';
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Bash
programs.bash = {
enable = true;
# Required to load nix in nix-toolbox
initExtra = ''
if test -f /run/.toolboxenv; then
source "$HOME/.nix-profile/etc/profile.d/nix.sh"
else
# fallback to original bashrc outside of toolbox
source $HOME/.bashrc.backup
fi
# Add local bin path
export PATH="$HOME/.local/bin:$PATH"
# Add onepassword-cli group required for 1password CLI integration to work
if ! grep -q onepassword-cli /etc/group; then
echo "Adding 'onepassword-cli' group"
sudo groupadd -f onepassword-cli
sudo usermod -aG onepassword-cli thrix
fi
# 1password needs to be run with the correct group for app CLI integration to work
run-op() {
sg onepassword-cli -c "op $*"
}
# set foot title
foot-title() {
echo -ne "\\033]0;$1\\007"
}
# set foot white theme
foot-white() {
# White background
printf '\e]11;#ffffff\a'
# Dark gray foreground (text)
printf '\e]10;#2e2e2e\a'
# Blue cursor for visibility
printf '\e]12;#005f87\a'
}
# resolve issues with dbus activation environment
flatpak-spawn --host --env=DISPLAY=:0 dbus-update-activation-environment --all --systemd
'';
# Aliases
shellAliases = {
# git
g = "git";
# ls
l = "ls -alh";
ll = "ls -l";
ls = "ls --color=tty";
# home-manager
hs = "make -C $HOME/git/github.com/thrix/nix-config switch";
# nvim
n = "nvim";
nd = "nvim -d";
# 1password with plugins
op = "run-op";
gh = "run-op plugin run -- gh";
glab = "run-op plugin run -- glab";
# redhat
rh-kinit = "op read \"op://redhat/Red\\ Hat\\ Kerberos/password\" | kinit $(op read \"op://redhat/Red\\ Hat\\ Kerberos/kinit_username\")";
oc-login-osd = "oc login --server=https://api.cyborg.fio9.p1.openshiftapps.com:6443 --token=$(ocp-sso-token https://api.cyborg.fio9.p1.openshiftapps.com:6443)";
oc-login-mp = "oc login --server https://api.mpp-e1-prod.9e4s.p1.openshiftapps.com:6443 --token=$(ocp-sso-token https://api.mpp-e1-prod.9e4s.p1.openshiftapps.com:6443)";
oc-login-itup = "oc login --server https://api.prod-scale-spoke1-aws-us-east-1.prod-scale-mgmthub1-aws-us-east-1.itup.redhat.com:443 --token=$(ocp-sso-token https://api.prod-scale-spoke1-aws-us-east-1.prod-scale-mgmthub1-aws-us-east-1.itup.redhat.com:443)";
};
};
# Bat
programs.bat.enable = true;
# Direnv
programs.direnv = {
enable = true;
enableBashIntegration = true;
};
# Firefox
programs.firefox = {
enable = true;
# NOTE: does not support well with pkgs.emptyDirectory
package = null;
configPath = ".mozilla/firefox";
profiles = {
default = {
# Keep the generated profile path aligned with hostConfig.files and
# the Silverblue host Firefox instance.
name = username;
path = username;
id = 0;
search = {
default = "google";
force = true;
};
settings = {
browser.startup.homepage = "https://google.com";
browser.search.region = "CZ";
browser.search.isUS = false;
distribution.searchplugins.defaultLocale = "en-US";
general.useragent.locale = "en-US";
browser.bookmarks.showMobileBookmarks = true;
browser.newtabpage.pinned = [
{
title = "Google";
url = "https://google.com";
}
];
};
containers = {
personal = {
color = "blue";
icon = "tree";
id = 2;
};
redhat = {
color = "red";
icon = "briefcase";
id = 1;
};
};
};
};
};
programs.foot = {
enable = true;
package = pkgs.emptyDirectory;
settings = {
main = {
term = "xterm-256color";
font = "monospace:size=12";
};
scrollback = {
lines = terminalHistoryLimit;
};
url = {
osc8-underline = "always";
};
key-bindings = {
show-urls-copy = "Control+Shift+y";
};
};
};
# GitHub CLI
programs.gh = {
enable = true;
settings = {
editor = "nvim";
aliases = {
co = "pr checkout";
};
};
};
# Git
programs.git = {
enable = true;
settings = {
alias = {
c = "commit";
cf = "commit -m fixup";
caf = "commit -a -m fixup";
cam = "commit --amend -vs";
p = "push";
pf = "push --force";
pm = "push -o merge_request.create";
pmd = "push -o merge_request.create -o merge_request.draft";
pms = "push -o merge_request.create -o merge_request.target=staging";
pr = "pull --rebase --autostash";
r = "rebase";
ri2 = "git rebase -i HEAD~2";
ri3 = "git rebase -i HEAD~3";
ri4 = "git rebase -i HEAD~4";
ri5 = "git rebase -i HEAD~5";
ri6 = "git rebase -i HEAD~6";
};
user = {
name = "Miroslav Vadkerti";
email = "mvadkert@redhat.com";
};
init = {
defaultBranch = "main";
};
push = {
autoSetupRemote = "true";
};
signing.format = "openpgp";
};
};
# Git Diffstatic
programs.difftastic = {
enable = true;
git.enable = true;
};
# Git Cliff
programs.git-cliff = {
enable = true;
};
# K9s
programs.k9s = {
enable = true;
};
# Man
programs.man = {
enable = true;
generateCaches = true;
};
# NixVim
programs.nixvim = {
enable = true;
globals = {
mapleader = " ";
};
opts = {
expandtab = true;
list = true;
listchars = "tab:› ,space:·,leadmultispace:· ,trail:·,precedes:«,extends:»,eol:¬";
relativenumber = true;
shiftwidth = 2;
mouse = "";
};
# Configure diagnostics
diagnostic.settings = {
virtual_text = {
enable = true;
spacing = 2;
prefix = "●";
};
underline = true;
update_in_insert = true;
signs = {
enable = true;
config = {
Error = {text = "✘";};
Warn = {text = "▲";};
Info = {text = "";};
Hint = {text = "⚑";};
};
};
};
# Colorscheme
colorschemes.tokyonight = {
enable = true;
settings = {
style = "night";
};
};
# Plugins
plugins = import ./nixvim/plugins.nix;
# Extra plugins not managed by nixvim modules
extraPlugins = [pkgs.vimPlugins.plenary-nvim];
# Extra config
extraConfigLua = ''
vim.filetype.add({
extension = {
fmf = "yaml",
},
})
'';
};
# SSH
programs.ssh = {
enable = true;
package = pkgs.emptyDirectory;
matchBlocks = {
"*" = {
extraOptions = {
IdentityAgent = "~/.1password/agent.sock";
};
};
"mvadkert" = {
hostname = "10.0.198.38";
user = "mvadkert";
};
};
};
# Starship
programs.starship.enable = true;
# Tmux
programs.tmux = {
enable = true;
clock24 = true;
historyLimit = terminalHistoryLimit;
shortcut = "a";
terminal = terminalType;
extraConfig = ''
set -g default-terminal "tmux-256color"
'';
};
# Waybar
programs.waybar = {
enable = true;
package = pkgs.emptyDirectory;
style = import ./waybar/style.nix;
settings = import ./waybar/settings.nix;
};
# Zoxide
programs.zoxide = {
enable = true;
enableBashIntegration = true;
};
# Sway
wayland.windowManager.sway = {
enable = true;
package = customPkgs.fedoraHost;
config = import ./sway/config.nix {inherit lib;};
# Not able to make the validation work for now :(
checkConfig = false;
# Disable systemd integration, managed by Silverblue.
systemd.enable = false;
};
# Xdg
xdg = {
enable = true;
desktopEntries = {
"1password" = {
name = "1Password";
type = "Application";
exec = "toolbox run --container nix 1password %U";
icon = "1password";
categories = ["Network" "Security"];
};
dropbox = {
name = "Dropbox";
type = "Application";
exec = "toolbox run --container nix dropbox";
icon = "dropbox";
categories = ["Network" "FileTransfer"];
};
discord = {
name = "Discord";
type = "Application";
exec = "toolbox run --container nix discord %U";
icon = "discord";
categories = ["Network" "InstantMessaging"];
};
# slack = {
# name = "Slack";
# type = "Application";
# exec = "toolbox run --container nix slack %U";
# icon = "slack";
# categories = ["Network" "InstantMessaging"];
# };
};
mimeApps = {
enable = true;
defaultApplications = {
"text/html" = "google-chrome.desktop";
"x-scheme-handler/http" = "google-chrome.desktop";
"x-scheme-handler/https" = "google-chrome.desktop";
# "x-scheme-handler/slack" = "slack.desktop";
"x-directory/normal" = "org.gnome.Nautilus.desktop";
"inode/directory" = "org.gnome.Nautilus.desktop";
"application/x-windsurf" = "windsurf.desktop";
};
};
};
# Kanshi
# services.kanshi = {
# enable = true;
# package = pkgs.emptyDirectory;
# profiles = {
# undocked = {
# name = "undocked";
# outputs = [
# { name = "eDP-1"; status = true; mode = "1920x1080"; position = "0,0"; }
# { name = "*"; status = false; }
# ];
# };
# "docked" = {
# name = "docked";
# outputs = [
# { name = "DP-7"; status = true; mode = "1920x1080"; position = "0,0"; }
# { name = "DP-9"; status = true; mode = "1680x1050"; position = "1920,0"; }
# { name = "eDP-1"; status = true; mode = "1920x1080"; position = "1920,1050"; }
# ];
# };
# "presentation" = {
# name = "presentation";
# outputs = [
# { name = "eDP-1"; status = true; mode = "1920x1080"; position = "0,0"; }
# { name = "*"; status = true; position = "1920,0"; }
# ];
# };
# };
# };
}