-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.nix
475 lines (422 loc) · 10.7 KB
/
configuration.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
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
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware.nix
./wireguard.nix
./vm-setup.nix
./scripts.nix
./pipewire.nix
./metrics.nix
#./ups.nix
./openrgb.nix
#./wifi.nix
./nix.nix
./mic-setup/mic-setup.nix
./smb.nix
];
boot.kernelPackages = pkgs.linuxPackages_latest;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelModules = [ "v4l2loopback" "snd_aloop" "msr" "zenpower" ];
boot.extraModulePackages = with config.boot.kernelPackages; [
v4l2loopback
zenpower
];
boot.extraModprobeConfig = ''
options v4l2loopback exclusive_caps=1 video_nr=9 card_label="OBS Virtual Output"
'';
boot.initrd.kernelModules = [ "vfio-pci" ];
boot.kernelParams = [ "noibrs" "noibpb" "nopti" "nospectre_v2" "nospectre_v1" "l1tf=off" "nospec_store_bypass_disable" "no_stf_barrier" "mds=off" "tsx=on" "tsx_async_abort=off" "mitigations=off" ]; # make-linux-fast-again.com
#boot.supportedFilesystems = [ "zfs" ];
boot.kernel.sysctl = {
"vm.max_map_count" = 2147483642;
};
boot.tmp = {
useTmpfs = true;
cleanOnBoot = true;
};
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
#memflow.kvm.enable = true;
networking.hostName = "nixos"; # Define your hostname.
networking.hostId = "d5794eb2"; # ZFS requires this
networking.extraHosts = ''
127.0.0.1 babbaj.proxy.localhost
127.0.0.1 normieslayer.proxy.localhost
192.168.69.69 100010.proxy.local
'';
system.activationScripts.appendHosts = {
deps = [ "etc" ];
text = ''
hostsSrc=$(realpath /etc/hosts)
rm /etc/hosts
cat $hostsSrc > /etc/hosts
cat /home/babbaj/hosts >> /etc/hosts
'';
};
time.timeZone = "America/New_York";
networking.useDHCP = false;
networking.interfaces.enp34s0.useDHCP = true;
#networking.interfaces.wlp35s0.useDHCP = true;
networking.networkmanager.enable = true;
networking.firewall.trustedInterfaces = [ "kittens" "vultr" "tailscale0" ];
networking.firewall.logRefusedConnections = false; # this has been filling my logs with junk
networking.firewall.allowedTCPPorts = [
51680
];
networking.firewall.allowedUDPPorts = [
51680
];
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
programs.steam.enable = true;
programs.java = {
enable = true;
#package = pkgs.jdk8;
};
programs.gnupg.agent.enable = true;
virtualisation.docker.enable = true;
hardware.nvidia-container-toolkit.enable = true;
# Enable the X11 windowing system.
services.xserver = {
enable = true;
videoDrivers = [ "nvidia" ];
excludePackages = [ pkgs.xterm ];
displayManager.gdm = {
#enable = true;
wayland = false; # gdm keeps using wayland when xorg is selected
};
displayManager.lightdm.enable = true;
#desktopManager.gnome.enable = true;
#desktopManager.plasma5.enable = true;
logFile = "/var/log/X.0.log"; # lightdm sets the log file to here but gdm does not
windowManager.i3 = {
enable = true;
package = pkgs.i3-gaps;
extraPackages = with pkgs; [
rofi
dmenu
i3status
i3lock
];
extraSessionCommands = ''
${pkgs.picom}/bin/picom &
${pkgs.hsetroot}/bin/hsetroot -solid '#000000'
'';
};
};
services.libinput.mouse.middleEmulation = false; # worst troll ever
services.desktopManager.plasma6.enable = true;
fonts.packages = with pkgs; [
cantarell-fonts
];
# Configure keymap in X11
services.xserver.xkb.layout = "us";
# Enable sound.
profiles.pipewire.enable = true;
services.vaultwarden = {
enable = true;
config = {
#ROCKET_ADDRESS = "0.0.0.0";
ROCKET_ADDRESS = "::";
};
backupDir = "/var/backup/vaultwarden";
};
systemd.services.vaultwarden.serviceConfig.StateDirectoryMode = lib.mkForce "0755";
services.openssh = {
enable = true;
openFirewall = false;
settings.PasswordAuthentication = false;
};
services.gnome.gnome-keyring.enable = true;
systemd.user.services.wal-rsync = rec {
enable = false;
description = "rsync wal logs ${startAt}";
startAt = "hourly";
serviceConfig = {
ExecStart = "${pkgs.rsync}/bin/rsync -av --progress -e '${pkgs.openssh}/bin/ssh' --delete f:/opt/postgres/wal/ /mnt/h/postgreswal/";
};
};
services.postgresql = {
enable = false;
package = pkgs.postgresql_12;
enableTCPIP = false;
dataDir = "/opt/postgres/base/data";
settings = {
restore_command = "${pkgs.gzip}/bin/gzip -d < /mnt/h/postgreswal/%f.gz > %p";
hot_standby = "on";
max_standby_archive_delay = "-1";
max_standby_streaming_delay = "-1";
};
};
systemd.services.stop-2070-fan = {
description = "Set the fan speed to 0";
wantedBy = [ "multi-user.target" ];
after = [ "display-manager.service" ];
script = ''
/run/current-system/sw/bin/run-gpu-idle-vm
'';
};
# warp-svc
#systemd.packages = with pkgs; [
# cloudflare-warp
#];
services.mullvad-vpn.enable = true;
services.mullvad-vpn.package = pkgs.mullvad-vpn;
services.tailscale.enable = true;
# cuckpak
services.flatpak.enable = true;
xdg.portal.enable = true;
hardware.openrazer = {
enable = true;
users = [ "babbaj" ];
};
services.plex.enable = true;
services.plex.openFirewall = true;
programs.ns-usbloader.enable = true;
services.udev.extraRules = ''
KERNEL=="hidraw*", TAG+="uaccess"
'';
hardware.bluetooth.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "20.09"; # Did you read the comment?
# Garbage Collection
nix = {
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
settings.auto-optimise-store = true;
#package = pkgs.nix_2_4;
};
programs.nix-ld.enable = true;
environment.systemPackages = with pkgs;
let
#glib is cringe https://github.com/GNOME/glib/blob/bc0d62424579f507f8d7af13bd29b6d86723f65f/gio/gdesktopappinfo.c#L2498-L2523
fake-xterm = pkgs.runCommand "xterm-imposter" {} ''
mkdir -p $out/bin
ln -s ${pkgs.kitty}/bin/kitty $out/bin/xterm
'';
ides = [
jetbrains.idea-ultimate
jetbrains.clion
jetbrains.goland
jetbrains.rider
jetbrains.pycharm-professional
jetbrains.rust-rover
vscode
qtcreator
];
dev-tools = [
zig_0_9
clang_18
llvm_18
gcc13
git
binutils
cmake
gnumake
ninja
pkg-config
go
linuxPackages.perf
perf-tools
dotnet-sdk
mono
gdb
lldb
valgrind
rustc
cargo
rustup
rust-cbindgen
astyle
];
shell-tools = [
coreutils
ripgrep
bat
wget
pv
neofetch
jq
iotop
htop
rlwrap
mbuffer
file
xclip xsel
asciinema
tmux
xxd
appimage-run
];
cli-tools = [
fdupes
duperemove
squashfsTools
squashfuse
#cloudflare-warp # warp-cli
bind # nslookup and dig
mediainfo
lepton # used by gb
compsize
pciutils
sqlite-interactive
smartmontools
ffmpeg-full
iperf
yt-dlp
usbutils
lm_sensors
inetutils
dmidecode
i2c-tools
gnupg
backblaze-b2
nvtopPackages.full
nmap
unzip
p7zip
unrar
psmisc # future installer requires killall
gb-backup
#geekbench
openssl
wireguard-tools
docker-compose
alsa-utils
libnotify
exfatprogs
graphviz
];
nix-tools = [
nix-diff
#nix-top
nixfmt-rfc-style
nix-direnv
direnv
fh
nix-alien
];
obs-stuff = import ./obs.nix pkgs;
in
ides ++
dev-tools ++
shell-tools ++
cli-tools ++
nix-tools ++
[
obs-stuff.patched-obs
obs-stuff.obs-autostart
] ++
(let
gpu-vm = (import "${modulesPath}/../" { configuration = ./gpu-idle-vm.nix; inherit (pkgs) system; }).vm;
in [
gpu-vm
texlive.combined.scheme-full
vlc
qbittorrent
prismlauncher
google-chrome
ungoogled-chromium
element-desktop
discord
virt-manager
tdesktop
flameshot
pavucontrol
zoom-us
qdirstat
piper # for the mouse
openvpn
spotify
networkmanagerapplet
gnome-tweaks
gparted
wireshark
wineWowPackages.staging
#libreoffice-qt
handbrake
ghidra-bin
#depotdownloader
bitwarden
droidcam
libsForQt5.kdenlive
libsForQt5.okular
monero-gui
nheko
lutris
xsecurelock
#gpu-screen-recorder
#gpu-screen-recorder-gtk
gimp
nixos-artwork.wallpapers.simple-dark-gray # dark gray background
fake-xterm
gnomeExtensions.gsconnect
mumble
audacity
mangohud
#soundux
r2modman
gnome-calculator
clonehero
gnome-system-monitor
python3
polychromatic
parted
neo4j
]);
#security.wrappers.looking-glass-ptrace = {
# owner = "babbaj";
# group = "babbaj";
# capabilities = "CAP_SYS_PTRACE=ep";
# source = "${pkgs.looking-glass-client}/bin/looking-glass-client";
#};
# for intellij
environment.etc = with pkgs; {
"jdk".source = jdk;
"jdk8".source = jdk8;
"jdk11".source = jdk11;
"jdk17".source = jdk17;
"zulu8".source = zulu8;
"jetbrains_jdk".source = jetbrains.jdk;
"jetbrains_jdk17".source = jetbrains.jdk-no-jcef-17;
};
# for mc dev
environment.sessionVariables.LD_LIBRARY_PATH = [ "${pkgs.xorg.libXxf86vm}" ];
environment.sessionVariables.NIXOS_OZONE_WL = "1";
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.babbaj = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "libvirtd" "input" "vaultwarden" ]; # Enable ‘sudo’ for the user.
shell = pkgs.zsh;
};
#security.sudo.wheelNeedsPassword = false; # troll face
programs.zsh.enable = true;
home-manager = {
users.babbaj = {
imports = [
./home/home.nix
];
home.stateVersion = config.system.stateVersion;
};
useUserPackages = true;
useGlobalPkgs = true;
verbose = true;
};
}