disko.nix 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 = [
  42. "compress=zstd1"
  43. "noatime"
  44. ];
  45. };
  46. "@nix" = {
  47. mountpoint = "/nix";
  48. mountOptions = [
  49. "compress=zstd1"
  50. "noatime"
  51. ];
  52. };
  53. "@persist" = {
  54. mountpoint = "/persist";
  55. mountOptions = [
  56. "compress=zstd1"
  57. "noatime"
  58. ];
  59. };
  60. "@services" = {
  61. mountpoint = "/var/lib";
  62. mountOptions = [
  63. "compress=zstd1"
  64. "noatime"
  65. "space_cache=v2"
  66. ];
  67. };
  68. "@logs" = {
  69. mountpoint = "/var/log";
  70. mountOptions = [
  71. "compress=zstd1"
  72. "noatime"
  73. ];
  74. };
  75. };
  76. };
  77. };
  78. };
  79. };
  80. };
  81. }
  82. // lib.attrsets.mapAttrs (name: value: {
  83. type = "disk";
  84. device = "/dev/disk/by-id/${value}";
  85. content = {
  86. type = "gpt";
  87. partitions = {
  88. primary = {
  89. size = "100%";
  90. content = {
  91. type = "filesystem";
  92. format = "xfs";
  93. mountpoint = "/mnt/${name}";
  94. mountOptions = [
  95. "defaults"
  96. "noatime"
  97. ];
  98. };
  99. };
  100. };
  101. };
  102. }) disks;
  103. };
  104. }