-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
329 lines (301 loc) · 7.11 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
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
{
config,
pkgs,
inputs,
lib,
...
}:
{
imports = [
./hardware-configuration.nix
../common.nix
../zsh.nix
{
disabledModules = [
"services/backup/btrbk.nix"
];
}
(inputs.nixpkgs-btrbk + "/nixos/modules/services/backup/btrbk.nix")
];
sops.age.keyFile = "/root/.config/sops/age/keys.txt";
sops.secrets = {
"borg/rsyncnet" = {
sopsFile = ../../secrets/borg/yt.yaml;
};
"services/ntfy" = {
sopsFile = ../../secrets/services/ntfy.yaml;
};
"wireguard/private" = {
sopsFile = ../../secrets/wireguard/yt.yaml;
};
"wireguard/psk" = {
sopsFile = ../../secrets/wireguard/yt.yaml;
};
"rsyncnet/id_ed25519" = {
sopsFile = ../../secrets/de3911/yt.yaml;
};
"newsboat/miniflux" = {
sopsFile = ../../secrets/newsboat.yaml;
owner = "yt";
};
};
boot = {
loader = {
# lanzaboote replaces systemd-boot
systemd-boot.enable = lib.mkForce false;
efi.canTouchEfiVariables = false; # toggle when installing
};
tmp.cleanOnBoot = true;
kernelPackages = pkgs.linuxPackages_latest;
extraModulePackages = with config.boot.kernelPackages; [
rtl8821ce
];
kernelParams = [
# see https://github.com/tomaspinho/rtl8821ce#pcie-active-state-power-management
"pcie_aspm=off"
];
# see https://github.com/tomaspinho/rtl8821ce#wi-fi-not-working-for-kernel--59
extraModprobeConfig = ''
blacklist rtw88_8821ce
'';
lanzaboote = {
enable = true;
pkiBundle = "/var/lib/sbctl";
};
kernel.sysctl."kernel.sysrq" = 1;
};
networking = {
hostName = "ytnix";
wireless.iwd = {
enable = true;
settings = {
Rank = {
# disable 2.4 GHz cause i have a shitty wireless card
# that interferes with bluetooth otherwise
BandModifier2_4GHz = 0.0;
};
};
};
networkmanager = {
enable = true;
dns = "none";
wifi.backend = "iwd";
};
nameservers = [
"31.59.129.225"
"2a0f:85c1:840:2bfb::1"
];
resolvconf.enable = true;
firewall = {
allowedUDPPorts = [ 51820 ]; # for wireguard
trustedInterfaces = [ "wg0" ];
};
};
programs.nm-applet.enable = true;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
pulse.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
wireplumber.extraConfig.bluetoothEnhancements = {
"wireplumber.settings" = {
"bluetooth.autoswitch-to-headset-profile" = false;
};
"monitor.bluez.properties" = {
"bluez5.enable-sbc-xq" = true;
"bluez5.enable-msbc" = true;
"bluez5.enable-hw-volume" = true;
"bluez5.roles" = [
"a2dp_sink"
"a2dp_source"
];
};
};
# https://wiki.archlinux.org/title/Bluetooth_headset#Connecting_works,_sound_plays_fine_until_headphones_become_idle,_then_stutters
wireplumber.extraConfig.disableSuspend = {
"monitor.bluez.rules" = {
matches = [
{
"node.name" = "bluez_output.*";
}
];
};
actions = {
update-props = {
"session.suspend-timeout-seconds" = 0;
};
};
};
};
services.libinput.enable = true;
users.users.yt.extraGroups = [
"wheel"
"libvirtd"
"docker"
];
environment.systemPackages = with pkgs; [
tmux
vim
wget
neovim
git
python3
wl-clipboard
mako
tree
kitty
borgbackup
brightnessctl
alsa-utils
nixd
bluetuith
libimobiledevice
pass-wayland
htop
file
dnsutils
age
compsize
wireguard-tools
traceroute
sops
restic
haskell-language-server
ghc
sbctl # secure boot
];
environment.sessionVariables = {
NIXOS_OZONE_WL = "1";
};
system.stateVersion = "24.05";
programs.gnupg.agent.enable = true;
services.displayManager = {
enable = true;
autoLogin.user = "yt";
};
fonts.packages = with pkgs; [
nerd-fonts.roboto-mono
ibm-plex
];
fonts.enableDefaultPackages = true;
hardware.enableAllFirmware = true;
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
services.blueman.enable = true;
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
};
my.backup = {
enable = true;
jobName = "ytnixRsync";
exclude = [
"/var/lib/private/ollama"
"/home/**/Downloads"
"/home/yt/fun"
"/home/yt/.local/share/Steam"
"**/.wine"
"/home/yt/Games"
];
repo = "yt";
passFile = config.sops.secrets."borg/rsyncnet".path;
sshKeyFile = config.sops.secrets."rsyncnet/id_ed25519".path;
};
services.btrbk.instances.local = {
onCalendar = "hourly";
# only create snapshots automatically. backups are triggered manually with `btrbk resume`
snapshotOnly = true;
settings = {
snapshot_preserve_min = "latest";
target_preserve = "*d";
target_preserve_min = "no";
target = "/mnt/external/btr_backup/ytnix";
stream_compress = "zstd";
stream_compress_level = "8";
snapshot_dir = "/snapshots";
subvolume = {
"/home" = { };
"/" = { };
};
};
};
programs.steam = {
enable = true;
extest.enable = true;
extraCompatPackages = with pkgs; [ proton-ge-bin ];
};
hardware.steam-hardware.enable = true;
services.logind = {
lidSwitch = "hibernate";
powerKey = "hibernate";
};
xdg.mime.defaultApplications = {
"application/pdf" = "okular.desktop";
"image/*" = "gwenview.desktop";
"*/html" = "chromium-browser.desktop";
};
programs.thunar = {
enable = true;
plugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-volman
];
};
# preference changes don't work in thunar without this
programs.xfconf.enable = true;
# mount, trash and stuff in thunar
services.gvfs.enable = true;
# thumbnails in thunar
services.tumbler.enable = true;
virtualisation = {
libvirtd.enable = true;
docker.enable = true;
};
programs.virt-manager.enable = true;
services.usbmuxd.enable = true;
programs.nix-ld.enable = true;
programs.evolution.enable = true;
xdg.portal = {
enable = true;
wlr.enable = true;
};
programs.obs-studio = {
enable = true;
plugins = with pkgs.obs-studio-plugins; [
wlrobs
];
};
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver
intel-media-sdk
];
};
services.ollama.enable = true;
# wireguard setup
networking.wg-quick.interfaces.wg0 = {
autostart = false;
address = [
"10.0.0.2/24"
"fdc9:281f:04d7:9ee9::2/64"
];
privateKeyFile = config.sops.secrets."wireguard/private".path;
peers = [
{
publicKey = "a16/F/wP7HQIUtFywebqPSXQAktPsLgsMLH9ZfevMy0=";
allowedIPs = [
"0.0.0.0/0"
"::/0"
];
endpoint = "31.59.129.225:51820";
persistentKeepalive = 25;
presharedKeyFile = config.sops.secrets."wireguard/psk".path;
}
];
};
services.trezord.enable = true;
}