disko.nix 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. { inputs, lib, ... }:
  2. let
  3. disks = {
  4. parity1 = "ata-ST8000VN002-2ZM188_WPV023WG";
  5. data1 = "ata-ST8000VN002-2ZM188_WPV07RMA";
  6. data2 = "ata-ST8000VN002-2ZM188_WPV020CG";
  7. };
  8. in
  9. {
  10. imports = [
  11. inputs.disko.nixosModules.disko
  12. ];
  13. disko.devices = {
  14. disk = {
  15. # Root system drive (1TB NVMe)
  16. main = {
  17. type = "disk";
  18. device = "/dev/disk/by-id/nvme-KINGSTON_SNV3S1000G_50026B7383CC0908";
  19. content = {
  20. type = "gpt";
  21. partitions = {
  22. # EFI boot partition
  23. efi = {
  24. size = "1G";
  25. type = "EF00";
  26. content = {
  27. type = "filesystem";
  28. format = "vfat";
  29. mountpoint = "/boot";
  30. };
  31. };
  32. # Main Btrfs partition
  33. root = {
  34. end = "-0";
  35. content = {
  36. type = "btrfs";
  37. extraArgs = [ "-f" ];
  38. subvolumes = {
  39. "@root" = {
  40. mountpoint = "/";
  41. mountOptions = [ "compress=zstd1" "noatime" ];
  42. };
  43. "@nix" = {
  44. mountpoint = "/nix";
  45. mountOptions = [ "compress=zstd1" "noatime" ];
  46. };
  47. "@persist" = {
  48. mountpoint = "/persist";
  49. mountOptions = [ "compress=zstd1" "noatime" ];
  50. };
  51. "@services" = {
  52. mountpoint = "/var/lib";
  53. mountOptions = [ "compress=zstd1" "noatime" "space_cache=v2" ];
  54. };
  55. "@logs" = {
  56. mountpoint = "/var/log";
  57. mountOptions = [ "compress=zstd1" "noatime" ];
  58. };
  59. };
  60. };
  61. };
  62. };
  63. };
  64. };
  65. } // lib.attrsets.mapAttrs
  66. (name: value: {
  67. type = "disk";
  68. device = "/dev/disk/by-id/${value}";
  69. content = {
  70. type = "gpt";
  71. partitions = {
  72. primary = {
  73. size = "100%";
  74. content = {
  75. type = "filesystem";
  76. format = "xfs";
  77. mountpoint = "/mnt/${name}";
  78. mountOptions = [ "defaults" "noatime" ];
  79. };
  80. };
  81. };
  82. };
  83. })
  84. disks;
  85. };
  86. }