-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfiguration.nix
598 lines (525 loc) · 16.9 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
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
593
594
595
596
597
598
# vim:tabstop=2:shiftwidth=2
# 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’).
# To rebuild/apply changes, run `sudo nixos-rebuild switch --flake .`
# To update, run `nix flake update`
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelParams = [
"nowatchdog"
"pcie_aspm=force"
"amd_iommu=force_enable"
"iommu.forcedac=1"
];
boot.kernel.sysctl."kernel.nmi_watchdog" = 0;
networking.hostName = "strawberry"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# makes it annoying when i lose my wifi connection on suspend/sleep
networking.networkmanager.wifi.powersave = false;
networking.firewall = {
enable = true;
allowedTCPPorts = [ 22 80 443 ];
allowedUDPPorts = [ 80 443 ];
};
# none of the nixos default NTP servers support NTS, so overriding them all is intended
# also this list is pretty arbitrary, but it's from a random selection of servers at
# <https://github.com/jauderho/nts-servers>
#
# also i use minsources 3 to validate the time using 3 servers/sources, so i'd like at
# least double the servers just in case i have 2 bad ones.
networking.timeServers = [
"ntppool1.time.nl"
"nts.netnod.se"
"ptbtime1.ptb.de"
"ohio.time.system76.com"
"time.txryan.com"
"time.dfm.dk"
];
# Set your time zone.
time.timeZone = "America/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
# services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.displayManager.sddm.wayland.enable = true;
services.desktopManager.plasma6.enable = true;
services.tailscale.enable = true;
# disable MagicDNS
services.tailscale.extraUpFlags = [ "--accept-dns=false" ];
services.nextdns.enable = true;
services.nextdns.arguments = [
"-cache-size=20MB"
"-profile=6ae877"
];
services.fwupd.enable = true;
services.fstrim.enable = true;
# enable fingerprint support
services.fprintd.enable = false;
services.fprintd.package = pkgs.fprintd-tod;
#services.fprintd.tod.enable = true;
#services.fprintd.tod.driver = pkgs.libfprint-tod;
services.power-profiles-daemon.enable = false;
services.thermald.enable = true;
services.tlp.enable = true;
services.tlp.settings = {
RUNTIME_PM_ON_AC="auto";
};
services.irqbalance.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# use chronyd for time instead of systemd-timesyncd because of NTS support for
# fully authenticated and encrypted time synchronisation, unlike NTP.
services.chrony = {
enable = true;
enableNTS = true;
# reduces latency caused by memory fragmentation
enableMemoryLocking = true;
extraFlags = [
# enables the highest level of the built-in syscall filter on chronyd for security
"-F1"
];
extraConfig = ''
# <https://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus1000/sw/4_0/qos/configuration/guide/nexus1000v_qos/qos_6dscp_val.pdf>
# <https://wikipedia.org/wiki/Differentiated_services>
#
# Service class: 46 == EF (Expedited Forwarding / High Priority, Low Latency)
dscp 46
# disables listening on a control/cmd port for chronyc, because i dont use it
cmdport 0
# disables bypassing certificate time checks. requires having a functioning RTC.
nocerttimecheck 0
# enforce/require time requests to be authenticated aka use NTS only and disallow plaintext NTP,
# and disallow all fallback to plaintext NTP.
authselectmode require
# requires at least 3 servers/sources provide us with a valid time before trusting/applying it
#
# when using NTS; this greatly reduces risk of malicious time-based attacks such as being
# fed wrong/bad timestamps to bypass certificate expiry, clock skew fingerprinting, etc
minsources 3
'';
};
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# bluetooth audio improvements; i have sony xm4s
services.pipewire.wireplumber.extraConfig.bluetoothEnhancements = {
"monitor.bluez.properties" = {
"bluez5.enable-sbc-xq" = true;
"bluez5.enable-msbc" = true;
"bluez5.enable-hw-volume" = true;
"bluez5.roles" = [ "hsp_hs" "hsp_ag" "hfp_hf" "hfp_ag" ];
};
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.adm-clementine = {
isNormalUser = true;
description = "June Clementine Strawberry";
extraGroups = [ "networkmanager" "wheel" "audio" "adbusers" ];
packages = with pkgs; [
kdePackages.kate
# thunderbird
];
shell = pkgs.zsh;
};
environment.sessionVariables = rec {
RUSTC_WRAPPER = "sccache";
SCCACHE_BUCKET = "sccache";
SCCACHE_REGION = "garage";
SCCACHE_ENDPOINT = "https://sccache.s3.garage.kennel.girlcock.ceo";
SCCACHE_ALLOW_CORE_DUMPS = "true";
SCCACHE_S3_USE_SSL = "true";
SCCACHE_CACHE_MULTIARCH = "true";
SCCACHE_LOG = "warn";
AWS_DEFAULT_REGION = "garage";
AWS_ENDPOINT_URL = "https://s3.garage.kennel.girlcock.ceo";
ATTIC_ENDPOINT = "https://attic.kennel.juneis.dog/conduwuit";
# TODO: how to add these in here safely for committing to git
#AWS_ACCESS_KEY_ID = "";
#AWS_SECRET_ACCESS_KEY= "";
#ATTIC_TOKEN = "";
GOPATH = "$HOME/go";
LIBCLANG_PATH = "${pkgs.llvmPackages_19.libclang.lib}/lib";
XDG_CACHE_HOME = "$HOME/.cache";
XDG_CONFIG_HOME = "$HOME/.config";
XDG_DATA_HOME = "$HOME/.local/share";
XDG_STATE_HOME = "$HOME/.local/state";
# not official
XDG_BIN_HOME = "$HOME/.local/bin";
PATH = [
"${GOPATH}/bin"
"${XDG_BIN_HOME}"
];
};
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
};
programs.htop = {
enable = true;
settings = {
fields="48 105 107 110 104 106 109 11 9 41 40 42 38 39 47 46 121 2 37 14 13 50 18 114 17 3 0 123 1";
hide_kernel_threads = false;
hide_userland_threads = false;
hide_running_in_container = false;
shadow_other_users = false;
show_thread_names = true;
show_program_path = false;
highlight_base_name = true;
highlight_deleted_exe = true;
shadow_distribution_path_prefix = false;
highlight_megabytes = true;
highlight_threads = true;
highlight_changes = true;
highlight_changes_delay_secs = true;
find_comm_in_cmdline = true;
strip_exe_from_cmdline = true;
show_merged_command = true;
header_margin = false;
screen_tabs = false;
detailed_cpu_time = true;
cpu_count_from_one = false;
show_cpu_usage = true;
show_cpu_frequency = true;
show_cpu_temperature = true;
degree_fahrenheit = false;
update_process_names = false;
account_guest_in_cpu_meter = false;
color_scheme=6;
enable_mouse = true;
delay = 18;
hide_function_bar = false;
header_layout="four_25_25_25_25";
column_meters_0="DiskIO NetworkIO";
column_meter_modes_0 ="1 1";
column_meters_1="AllCPUs2";
column_meter_modes_1 = 1;
column_meters_2="Memory Swap";
column_meter_modes_2 ="1 1";
column_meters_3="LoadAverage Tasks";
column_meter_modes_3 ="1 2";
tree_view = false;
sort_key=46;
tree_sort_key=3;
sort_direction=-1;
tree_sort_direction = true;
tree_view_always_by_pid = true;
all_branches_collapsed = false;
"screen:Main" = "USER SYSCW WBYTES IO_WRITE_RATE SYSCR RBYTES IO_READ_RATE MAJFLT MINFLT M_TRS M_SHARE M_DRS M_VIRT M_RESIDENT PERCENT_MEM PERCENT_CPU CTXT STATE PROCESSOR STIME UTIME NLWP NICE IO_PRIORITY PRIORITY PPID PID COMM Command";
".sort_key"="PERCENT_CPU";
".tree_sort_key"="PPID";
".tree_view_always_by_pid"=1;
".tree_view"=0;
".sort_direction"=-1;
".tree_sort_direction"=1;
".all_branches_collapsed"=0;
};
};
# Install firefox.
programs.firefox.enable = true;
# fuck
programs.thefuck.enable = true;
programs.kdeconnect.enable = true;
programs.git.enable = true;
programs.git.lfs.enable = true;
programs.git.prompt.enable = true;
programs.git.config = [
{
init = { defaultBranch = "main"; };
url = {
"https://github.com/" = {
insteadOf = [ "gh:" "github:" ];
};
};
global = { gpgsign = true; };
user = {
name = "June Clementine Strawberry";
email = "[email protected]";
signingkey = "~/.ssh/id_ed25519";
};
core = { compression = 9; };
alias = {
# i use this for conduwuit so i can push to all my mirrors easily
pushall = "!git remote | grep -E 'origin' | xargs -L1 -P 0 git push";
fetchall = "!git remote | grep -E 'origin' | xargs -L1 -P 0 git fetch";
};
# no meme gpg pls
gpg.format = "ssh";
}
];
programs.adb.enable = true;
# appimage support
programs.appimage = {
enable = true;
binfmt = true;
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Allow insecure libolm, used by gomuks
nixpkgs.config.permittedInsecurePackages = [
"olm-3.2.16"
];
fonts = {
enableDefaultPackages = true;
packages = with pkgs; [
twitter-color-emoji
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
corefonts
# woozy
monocraft
];
};
nix = {
# awa
package = pkgs.lix;
settings = {
experimental-features = ["nix-command" "flakes"];
substituters = [
"https://attic.kennel.juneis.dog/conduwuit"
"https://nix-community.cachix.org"
"https://aseipp-nix-cache.freetls.fastly.net"
"https://conduwuit.cachix.org"
"https://cache.lix.systems/"
"https://cache.nixos.org/"
];
trusted-public-keys = [
"cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o="
"conduwuit:BbycGUgTISsltcmH0qNjFR9dbrQNYgdIAcmViSGoVTE="
"conduwuit.cachix.org-1:MFRm6jcnfTf0jSAbmvLfhO3KBMt4px+1xaereWXp8Xg="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
p7zip
moreutils
git
pv
nvme-cli
smartmontools
vscode
go
neovim
wget
curl
zip
unzip
signal-desktop
spotify
kitty
kitty-img
bitwarden-desktop
bitwarden-cli
ktailctl
nodejs_22
corepack_22
thunderbird
vesktop
hyfetch
fastfetch
nextdns
microcode-amd
nix-output-monitor
nix-fast-build
real_time_config_quick_scan
sccache
qbittorrent-enhanced
cargo-mommy # awoozy
bison
flex
fontforge
makeWrapper
pkg-config
pkgconf
libpkgconf
liburing
gcc14
gcc14Stdenv
libgcc
libiconv
clang_19
binutils
llvmPackages_19.libcxxClang
llvmPackages_19.libllvm
llvmPackages_19.stdenv
llvmPackages_19.libcxx
llvmPackages_19.libcxxStdenv
llvmPackages_19.compiler-rt
llvmPackages_19.clangUseLLVM
autoconf
automake
libtool
gnumake
awscli2
slack
slackdump
killall
jq
bitwarden-cli
ffmpeg-full
olm
bind # for dig
wireshark
attic-client
pciutils
usbutils
lshw
binwalk
rar
unrar
yubioath-flutter
yubikey-agent
];
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
vteIntegration = true;
histSize = 10000;
shellAliases = {
lix = "nix";
grep = "grep --color=auto";
ssh = "kitten ssh";
neofetch = "hyfetch";
cargo = "cargo-mommy"; # awoozy
};
ohMyZsh = {
enable = true;
plugins = [ "git" "thefuck" "command-not-found" ];
theme = "alanpeabody";
};
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
enableZshIntegration = true;
};
# enable nix-ld so random binaries are more likely to work
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
# put libraries needed by random binaries you download here
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon. because sometimes i like to ssh from my mac/desktop.
services.openssh = {
enable = true;
# we only accept ed25519 connections, so only make ed25519 hostkey
hostKeys = [
{
path = "/etc/ssh/ssh_host_ed25519_key";
type = "ed25519";
}
];
settings = {
# <https://wiki.osuosl.org/howtos/ssh_ip_qos_fix.html>
# <https://wikipedia.org/wiki/Differentiated_services>
#
# Service class: af21 Low-latency data , af11 High-throughput data
IPQoS = "af21 af11";
# we only accept modern, ed25519 key, and ChaCha20/AES-256-GCM connections
# also AES-GCM and ChaCha20 are already inherently authenticated
Macs = [ "-*" ];
KexAlgorithms = [ "[email protected]" "curve25519-sha256" ];
PubkeyAcceptedKeyTypes = "ssh-ed25519,[email protected]";
Ciphers = [ "[email protected]" "[email protected]" ];
PasswordAuthentication = false;
PermitEmptyPasswords = false;
AllowUsers = [ "adm-clementine" ];
UseDns = true;
X11Forwarding = false;
PermitRootLogin = "prohibit-password";
};
};
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
nix.settings.allowed-users = [ "@wheel" ];
security.sudo.execWheelOnly = true;
services.pcscd.enable = true;
services.udev.packages = [
pkgs.android-udev-rules
pkgs.yubikey-personalization
];
# when can we get a realtime-privileges package in nixos so i aint gotta do allat
security.pam.loginLimits = [
{ domain = "@users"; item = "rtprio" ; type = "-" ; value = "1" ; }
{ domain = "@audio"; item = "memlock"; type = "-" ; value = "unlimited"; }
{ domain = "@audio"; item = "rtprio" ; type = "-" ; value = "99" ; }
{ domain = "@audio"; item = "nofile" ; type = "soft"; value = "99999999" ; }
{ domain = "@audio"; item = "nofile" ; type = "hard"; value = "99999999" ; }
];
services.udev.extraRules = ''
# realtime audio stuff
KERNEL=="rtc0", GROUP="audio"
KERNEL=="hpet", GROUP="audio"
# Allow <5% brightness to persist on reboot (disable clamped value of 5%)
SUBSYSTEM=="backlight", ENV{ID_BACKLIGHT_CLAMP}="0"
'';
# 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 = "24.11"; # Did you read the comment?
}