1
0

system.nix 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. { config, ... }:
  2. {
  3. # Boot configuration
  4. boot = {
  5. # Use systemd-boot for UEFI systems
  6. loader.systemd-boot.enable = true;
  7. loader.efi.canTouchEfiVariables = true;
  8. loader.grub.devices = [
  9. config.disko.devices.disk.main.device
  10. ];
  11. loader.timeout = 3;
  12. # Kernel parameters for server workload
  13. kernelParams = [ "rootflags=compress=zstd:1,noatime" ];
  14. kernelModules = [ "nct6775" ];
  15. # Enable KSM for memory efficiency with containers
  16. kernel.sysctl = {
  17. "kernel.sysrq" = 1;
  18. "vm.swappiness" = 10;
  19. "net.core.default_qdisc" = "cake";
  20. };
  21. };
  22. hardware.fancontrol = {
  23. enable = true;
  24. config = ''
  25. INTERVAL=10
  26. DEVPATH=hwmon1=devices/pci0000:00/0000:00:02.2/0000:04:00.0/nvme/nvme0 hwmon2=devices/platform/nct6775.656
  27. DEVNAME=hwmon1=nvme hwmon2=nct6798
  28. FCTEMPS=hwmon2/pwm7=hwmon1/temp1_input hwmon2/pwm2=hwmon1/temp1_input
  29. FCFANS=hwmon2/pwm7=hwmon2/fan7_input hwmon2/pwm2=hwmon2/fan2_input
  30. MINTEMP=hwmon2/pwm7=30 hwmon2/pwm2=30
  31. MAXTEMP=hwmon2/pwm7=60 hwmon2/pwm2=60
  32. MINSTART=hwmon2/pwm7=95 hwmon2/pwm2=150
  33. MINSTOP=hwmon2/pwm7=75 hwmon2/pwm2=0
  34. '';
  35. };
  36. services.hddfancontrol.enable = true;
  37. services.hddfancontrol.settings = {
  38. harddrives =
  39. let
  40. devices = config.disko.devices.disk;
  41. in
  42. {
  43. disks = [
  44. devices.parity1.device
  45. devices.data1.device
  46. devices.data2.device
  47. ];
  48. pwmPaths = [
  49. "/sys/class/hwmon/hwmon2/pwm1:20:0"
  50. "/sys/class/hwmon/hwmon2/pwm4:80:60"
  51. ];
  52. logVerbosity = "DEBUG";
  53. extraArgs = [
  54. "--min-fan-speed-prct=0"
  55. ];
  56. };
  57. };
  58. # Btrfs maintenance
  59. services.btrfs.autoScrub = {
  60. enable = true;
  61. interval = "monthly";
  62. fileSystems = [ "/" ];
  63. };
  64. }