-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpluto.nix
394 lines (359 loc) · 8.95 KB
/
pluto.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
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
{
pkgs,
umu,
...
}: {
imports = [
./_shared/common.nix
./hardware/pluto.nix
./mounts/orpheus-nfs.nix
./programs/direnv.nix
./programs/steam.nix
./services/audio-pipewire.nix
./services/chipcards.nix
./services/printing.nix
./services/scanning.nix
./users/maik.nix
];
# Set hostname
networking.hostName = "pluto";
# Set kernel parameters
boot.kernelParams = [
# Disable mitigiations for some extra performance
"mitigations=off"
# Allow overclocking of GPU
"amdgpu.ppfeaturemask=0xfff7ffff"
# Use pstate_epp for CPU reclocking
"amd_pstate=active"
];
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
# Overclock and undervolt AMD GPU
environment.etc."tmpfiles.d/gpu-undervolt.conf".text = ''
w+ /sys/class/drm/card1/device/pp_od_clk_voltage - - - - vo -100\n
w+ /sys/class/drm/card1/device/pp_od_clk_voltage - - - - m 1 1200\n
w+ /sys/class/drm/card1/device/pp_od_clk_voltage - - - - c\n
'';
# Use latest stable kernel
boot.kernelPackages = pkgs.linuxPackages_latest;
# Enable bluetooth
hardware.bluetooth.enable = true;
# Use zram as swap
zramSwap = {
enable = true;
algorithm = "zstd";
};
# Enable plymouth
boot.plymouth.enable = true;
# Disable ttys
services.logind.extraConfig = ''
NAutoVTs=0
ReserveVT=0
'';
# Use german keyboard layout
services.xserver = {
enable = true;
# set keymap
xkb.layout = "de";
};
# Use plasma as desktop environment
services.desktopManager.plasma6.enable = true;
# Use SDDM as displayManager
services.displayManager.sddm = {
enable = true;
wayland = {
enable = true;
compositor = "kwin";
};
};
# Use NetworkManager
networking.networkmanager.enable = true;
# Enable tailscale
services.tailscale.enable = true;
# Disable NetworkManager wait online
systemd.services."NetworkManager-wait-online".enable = false;
# Enable mDNS
services.avahi.enable = true;
# Add inter, jetbrains-mono and noto fonts
fonts.packages = with pkgs; [
inter
jetbrains-mono
noto-fonts
noto-fonts-cjk-sans
noto-fonts-emoji
];
# List of system-wide packages
environment.systemPackages = with pkgs; [
(umu.packages.${pkgs.system}.umu)
aqbanking
aspell
aspellDicts.de
aspellDicts.en
digikam
fan2go
ffmpegthumbs
firefox
fooyin
gitMinimal
kdePackages.akonadi
kdePackages.akonadi-calendar
kdePackages.akonadi-contacts
kdePackages.akonadi-mime
kdePackages.akonadi-search
kdePackages.alpaka
kdePackages.elisa
kdePackages.kdepim-addons
kdePackages.kdepim-runtime
kdePackages.kleopatra
kdePackages.kmail
kdePackages.kmail-account-wizard
kdePackages.kmymoney
kdePackages.ksshaskpass
kdePackages.merkuro
kdePackages.qtlocation
kdePackages.skanpage
kdePackages.tokodon
kdePackages.kio-extras
libcamera
libreoffice-qt
lm_sensors
mpv
nfs-utils
pinentry-qt
sbctl
syncthing
transmission_4-qt
unar
zed-editor
];
# Enable flatpak
services.flatpak.enable = true;
systemd.services.flatpak-repo = {
wantedBy = ["multi-user.target"];
path = [pkgs.flatpak];
script = ''
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
'';
};
# Enable user service for syncthing
# systemd.user.services.syncthing.wantedBy = ["default.target"];
# Enable custom fan control
boot.kernelModules = ["nct6775"]; # motherboard sesnsors
environment.etc."fan2go/fan2go.yaml".text = ''
fans:
- id: front_bottom
hwmon:
platform: nct6798-isa-0290
index: 1
neverStop: true
curve: front_curve
- id: front_top
hwmon:
platform: nct6798-isa-0290
index: 5
neverStop: true
curve: front_curve
- id: top
hwmon:
platform: nct6798-isa-0290
index: 7
neverStop: true
curve: front_curve
- id: back
hwmon:
platform: nct6798-isa-0290
index: 6
neverStop: true
curve: cpu_curve
- id: cpu
hwmon:
platform: nct6798-isa-0290
index: 2
neverStop: true
curve: cpu_curve
- id: gpu
hwmon:
platform: nct6798-isa-0290
index: 4
neverStop: true
curve: gpu_curve
sensors:
- id: gpu_edge
hwmon:
platform: amdgpu-pci-0a00
index: 1
- id: gpu_mem
hwmon:
platform: amdgpu-pci-0a00
index: 3
- id: cpu_tctl
hwmon:
platform: k10temp-pci-00c3
index: 1
curves:
- id: gpu_edge_curve
linear:
sensor: gpu_edge
steps:
- '50': 80
- '60': 100
- '70': 130
- id: gpu_mem_curve
linear:
sensor: gpu_mem
steps:
- '70': 80
- '90': 100
- '100': 150
- '100': 155
- id: gpu_curve
function:
type: maximum
curves:
- gpu_edge_curve
- gpu_mem_curve
- id: cpu_curve
linear:
sensor: cpu_tctl
steps:
- '50': 80
- '60': 100
- '70': 130
- id: front_curve
function:
type: maximum
curves:
- front_cpu_curve
- front_gpu_curve
- id: front_cpu_curve
linear:
sensor: cpu_tctl
steps:
- '50': 50
- '60': 70
- '70': 110
- id: front_gpu_curve
linear:
sensor: gpu_edge
steps:
- '55': 50
- '60': 110
- '65': 150
'';
systemd.services.fan2go = {
enable = true;
after = ["lm-sensors.service"];
description = "Advanced Fan Control program";
path = [pkgs.procps];
serviceConfig = {
Type = "simple";
Restart = "always";
RestartSec = "1s";
ExecStart = ''${pkgs.fan2go}/bin/fan2go -c /etc/fan2go/fan2go.yaml --no-style'';
};
wantedBy = ["multi-user.target"];
};
# load ath11k modules after suspend
systemd.services.ath11k-resume = {
description = "Load ath11k_pci module after suspend";
after = ["suspend.target"];
serviceConfig = {
Type = "simple";
ExecStart = ''${pkgs.kmod}/bin/modprobe ath11k_pci'';
};
wantedBy = ["suspend.target"];
};
# unload ath11k modules before suspend
systemd.services.ath11k-suspend = {
description = "Unload ath11k_pci module before suspend";
before = ["sleep.target"];
serviceConfig = {
Type = "simple";
ExecStart = ''${pkgs.kmod}/bin/rmmod ath11k_pci'';
};
wantedBy = ["sleep.target"];
};
# ssh server with public key authentication only
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
};
# Setup firewall
networking.firewall = {
enable = true;
allowedTCPPorts = [
# syncthing
22000 # sync
# transmission
43219
];
allowedTCPPortRanges = [
# kdeconnect
{
from = 1714;
to = 1764;
}
];
allowedUDPPorts = [
# syncthing
22000
21027
# transmission
43219
];
allowedUDPPortRanges = [
# kdeconnect
{
from = 1714;
to = 1764;
}
];
# if packets are still dropped, they will show up in dmesg
logReversePathDrops = true;
# wireguard trips rpfilter up
extraCommands = ''
ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --sport 1637 -j RETURN
ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --dport 1637 -j RETURN
'';
extraStopCommands = ''
ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --sport 1637 -j RETURN || true
ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --dport 1637 -j RETURN || true
'';
};
services.ollama = {
enable = true;
acceleration = "rocm";
rocmOverrideGfx = "11.0.0";
};
hardware.amdgpu.opencl.enable = true;
hardware.graphics.extraPackages = with pkgs; [rocmPackages.clr.icd];
programs.gnupg.agent = {
enable = true;
pinentryPackage = pkgs.pinentry-qt;
};
# Enable kdeconnect
programs.kdeconnect = {
enable = true;
};
# Enable gamescope
programs.gamescope = {
enable = true;
};
# Enable dconf (needed for configuration of gtk themes under wayland)
programs.dconf.enable = true;
# Enable gamemode
programs.gamemode = {
enable = true;
settings = {
general. renice = 10;
};
};
# Enable ssh-agent
programs.ssh = {
startAgent = true;
enableAskPassword = true;
askPassword = "${pkgs.kdePackages.ksshaskpass}/bin/ksshaskpass";
};
environment.sessionVariables.SSH_ASKPASS_REQUIRE = "prefer";
system.stateVersion = "24.05";
}