hardware-configuration.nix 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. {
  2. config,
  3. pkgs,
  4. lib,
  5. modulesPath,
  6. inputs,
  7. username,
  8. ...
  9. }:
  10. {
  11. imports = [
  12. (modulesPath + "/installer/scan/not-detected.nix")
  13. inputs.lanzaboote.nixosModules.lanzaboote
  14. ];
  15. boot = {
  16. # Lanzaboote currently replaces the systemd-boot module.
  17. # This setting is usually set to true in configuration.nix
  18. # generated at installation time. So we force it to false
  19. # for now.
  20. loader = {
  21. systemd-boot.enable = lib.mkForce false;
  22. systemd-boot.configurationLimit = 5;
  23. efi.canTouchEfiVariables = true;
  24. efi.efiSysMountPoint = "/boot";
  25. };
  26. lanzaboote = {
  27. enable = true;
  28. pkiBundle = "/etc/secureboot";
  29. };
  30. kernelPackages = lib.mkForce inputs.chaotic.packages.${pkgs.system}.linuxPackages_cachyos;
  31. initrd.availableKernelModules = [
  32. "nvme"
  33. "xhci_pci"
  34. "ahci"
  35. "usb_storage"
  36. "usbhid"
  37. "sd_mod"
  38. ];
  39. initrd.kernelModules = [
  40. "amdgpu"
  41. "bcachefs"
  42. "dm-snapshot"
  43. ];
  44. kernelModules = [ "kvm-amd" ];
  45. extraModulePackages = [ ];
  46. supportedFilesystems = [
  47. "bcachefs"
  48. "ntfs"
  49. "xfs"
  50. ];
  51. };
  52. fileSystems =
  53. let
  54. inherit username;
  55. userHome = "/home/${username}";
  56. in
  57. {
  58. "${userHome}/Media" = {
  59. device = "/dev/disk/by-uuid/9f731a8a-1d76-4b74-ad60-cb2e245d4224";
  60. fsType = "bcachefs";
  61. options = [
  62. # Enable discard/TRIM support
  63. "discard"
  64. # foreground compression with zstd
  65. "compression=zstd"
  66. # background compression with zstd
  67. "background_compression=zstd"
  68. ];
  69. };
  70. # "${userHome}/WinE" = {
  71. # device = "/dev/disk/by-label/WinE";
  72. # fsType = "ntfs";
  73. # options = [
  74. # "uid=1000"
  75. # "gid=100"
  76. # "rw"
  77. # "user"
  78. # "exec"
  79. # "umask=000"
  80. # "nofail"
  81. # ];
  82. # };
  83. "/" = {
  84. device = "none";
  85. fsType = "tmpfs";
  86. options = [
  87. "defaults"
  88. "size=2G"
  89. "mode=755"
  90. ];
  91. };
  92. "/boot" = {
  93. device = "/dev/disk/by-label/BOOT";
  94. fsType = "vfat";
  95. };
  96. "/nix" = {
  97. device = "/dev/disk/by-partlabel/Store";
  98. fsType = "bcachefs";
  99. options = [
  100. # Enable discard/TRIM support
  101. "discard"
  102. # foreground compression with zstd
  103. "compression=zstd"
  104. # background compression with zstd
  105. "background_compression=zstd"
  106. ];
  107. };
  108. "/home" = {
  109. device = "/dev/disk/by-partlabel/Home";
  110. fsType = "bcachefs";
  111. options = [
  112. # Enable discard/TRIM support
  113. "discard"
  114. # foreground compression with zstd
  115. "compression=zstd"
  116. # background compression with zstd
  117. "background_compression=zstd"
  118. ];
  119. neededForBoot = true;
  120. };
  121. "/persist" = {
  122. device = "/dev/disk/by-label/Persist";
  123. fsType = "xfs";
  124. neededForBoot = true;
  125. };
  126. "/etc/nixos" = {
  127. device = "/persist/etc/nixos";
  128. fsType = "none";
  129. options = [ "bind" ];
  130. };
  131. "/var/log" = {
  132. device = "/persist/var/log";
  133. fsType = "none";
  134. options = [ "bind" ];
  135. };
  136. };
  137. swapDevices = [ { device = "/dev/disk/by-label/Swap"; } ];
  138. # slows down boot time
  139. systemd.services.NetworkManager-wait-online.enable = false;
  140. nix.settings.max-jobs = lib.mkDefault 4;
  141. nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  142. # powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
  143. hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
  144. }