NixOS configuration for HPC cluster https://docs.hpc.informatik.hs-fulda.de/
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.

97 lines
2.3 KiB

11 months ago
11 months ago
11 months ago
11 months ago
  1. { pkgs, lib, config, nodes, ... }:
  2. with lib;
  3. let
  4. mkReservations = net: concatLists (mapAttrsToList
  5. (_: node: optional (hasAttr net node.config.hpc.dhcp.reservations) {
  6. "hw-address" = node.config.hpc.dhcp.reservations.${net}.hwAddress;
  7. "ip-address" = node.config.hpc.dhcp.reservations.${net}.ipAddress;
  8. })
  9. nodes);
  10. in
  11. {
  12. services.kea = {
  13. dhcp4 = {
  14. enable = true;
  15. settings = {
  16. "valid-lifetime" = 4000;
  17. "renew-timer" = 1000;
  18. "rebind-timer" = 2000;
  19. "interfaces-config" = {
  20. "interfaces" = [ "mngt" "data" ];
  21. };
  22. "lease-database" = {
  23. "type" = "memfile";
  24. "persist" = true;
  25. "name" = "/var/lib/kea/dhcp4.leases";
  26. };
  27. "subnet4" = [
  28. {
  29. "subnet" = "10.32.46.0/24";
  30. "interface" = "mngt";
  31. "option-data" = [
  32. {
  33. "name" = "routers";
  34. "data" = config.networking.defaultGateway.address;
  35. }
  36. {
  37. "name" = "domain-name-servers";
  38. "data" = "10.0.0.53,10.1.1.10";
  39. }
  40. {
  41. "name" = "domain-name";
  42. "data" = "mngt.${config.networking.domain}";
  43. }
  44. {
  45. "name" = "domain-search";
  46. "data" = "mngt.${config.networking.domain}";
  47. }
  48. ];
  49. "pools" = [
  50. {
  51. "pool" = "10.32.46.100-10.32.46.200";
  52. }
  53. ];
  54. "reservations" = mkReservations "mngt";
  55. }
  56. {
  57. "subnet" = "10.32.47.0/24";
  58. "interface" = "data";
  59. "option-data" = [
  60. {
  61. "name" = "domain-name-servers";
  62. "data" = "10.0.0.53,10.1.1.10";
  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. "pools" = [
  74. {
  75. "pool" = "10.32.47.100-10.32.47.200";
  76. }
  77. ];
  78. "reservations" = mkReservations "data";
  79. }
  80. ];
  81. };
  82. };
  83. };
  84. }