NixOS deployment for LinuxLab
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
2.2 KiB

2 weeks ago
  1. { pkgs, config, ... }:
  2. {
  3. services.kea.dhcp4 = {
  4. enable = true;
  5. settings = {
  6. interfaces-config = {
  7. interfaces = [
  8. "enp4s0f0"
  9. "enp4s0f1"
  10. ];
  11. };
  12. lease-database = {
  13. name = "/var/lib/kea/dhcp4.leases";
  14. persist = true;
  15. type = "memfile";
  16. };
  17. rebind-timer = 2000;
  18. renew-timer = 1000;
  19. subnet4 = [
  20. {
  21. subnet = "10.33.64.0/20";
  22. interface = "enp4s0f1";
  23. pools = [
  24. {
  25. pool = "10.33.65.100 - 10.33.65.200";
  26. }
  27. ];
  28. option-data = [
  29. {
  30. name = "routers";
  31. data = "10.33.64.1";
  32. }
  33. {
  34. name = "domain-name-servers";
  35. data = "10.0.0.53";
  36. }
  37. {
  38. name = "domain-name";
  39. data = config.networking.domain;
  40. }
  41. {
  42. name = "domain-search";
  43. data = config.networking.domain;
  44. }
  45. ];
  46. }
  47. {
  48. subnet = "10.32.44.0/24";
  49. interface = "enp4s0f1";
  50. pools = [
  51. {
  52. pool = "10.32.44.100 - 10.32.44.200";
  53. }
  54. ];
  55. option-data = [
  56. {
  57. name = "routers";
  58. data = "10.32.44.1";
  59. }
  60. {
  61. name = "domain-name-servers";
  62. data = "10.0.0.53";
  63. }
  64. {
  65. name = "domain-name";
  66. data = config.networking.domain;
  67. }
  68. {
  69. name = "domain-search";
  70. data = config.networking.domain;
  71. }
  72. ];
  73. }
  74. ];
  75. valid-lifetime = 4000;
  76. };
  77. };
  78. networking.firewall.allowedUDPPorts = [
  79. 67
  80. 68 # DHCP
  81. ];
  82. services.pixiecore =
  83. let
  84. script = pkgs.writeText "boot-local.ipxe" ''
  85. #!ipxe
  86. sleep 2
  87. sanboot -n -d 0x80
  88. shell
  89. '';
  90. in
  91. {
  92. enable = true;
  93. dhcpNoBind = true;
  94. port = 5080;
  95. mode = "boot";
  96. kernel = toString script;
  97. openFirewall = true;
  98. };
  99. }