Grapple4139

disk-config.nix

Sep 4th, 2023
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | Software | 0 0
  1. # Example to create a bios compatible gpt partition
  2. { lib, disks ? [ "/dev/vda" ], ... }: {
  3. disk = lib.genAttrs disks (dev: {
  4. device = dev;
  5. type = "disk";
  6. content = {
  7. type = "table";
  8. format = "gpt";
  9. partitions = [
  10. {
  11. name = "boot";
  12. start = "0";
  13. end = "1M";
  14. part-type = "primary";
  15. flags = ["bios_grub"];
  16. }
  17. {
  18. name = "ESP";
  19. start = "1MiB";
  20. end = "100MiB";
  21. bootable = true;
  22. content = {
  23. type = "mdraid";
  24. name = "boot";
  25. };
  26. }
  27. {
  28. name = "root";
  29. start = "100MiB";
  30. end = "100%";
  31. part-type = "primary";
  32. bootable = true;
  33. content = {
  34. type = "lvm_pv";
  35. vg = "pool";
  36. };
  37. }
  38. ];
  39. };
  40. });
  41. mdadm = {
  42. boot = {
  43. type = "mdadm";
  44. level = 1;
  45. metadata = "1.0";
  46. content = {
  47. type = "filesystem";
  48. format = "vfat";
  49. mountpoint = "/boot";
  50. };
  51. };
  52. };
  53. lvm_vg = {
  54. pool = {
  55. type = "lvm_vg";
  56. lvs = {
  57. root = {
  58. size = "100%FREE";
  59. content = {
  60. type = "filesystem";
  61. format = "xfs";
  62. mountpoint = "/";
  63. mountOptions = [
  64. "defaults"
  65. ];
  66. };
  67. };
  68. };
  69. };
  70. };
  71. }
  72.  
Advertisement
Add Comment
Please, Sign In to add comment