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.

93 lines
2.2 KiB

  1. # TFTP boot with shared image
  2. # Requests store path to install from master
  3. # Runs disko and nixos-install
  4. { pkgs, lib, config, nodes, ... }@args:
  5. with lib;
  6. let
  7. targets = {
  8. "50:46:5d:da:0b:d6" = "node-00";
  9. "50:46:5d:da:0c:56" = "node-01";
  10. "50:46:5d:da:0c:52" = "node-02";
  11. "10:bf:48:1f:a6:8f" = "node-03";
  12. # "10:bf:48:1b:57:47" = "node-04";
  13. # "10:bf:48:19:a2:4d" = "node-05";
  14. # "10:bf:48:1b:56:df" = "node-06";
  15. };
  16. installer = pkgs.nixos [
  17. ./installer.nix
  18. {
  19. _module.args = {
  20. managerConfig = config;
  21. };
  22. }
  23. ];
  24. commands = pkgs.symlinkJoin {
  25. name = "pxeboot";
  26. paths = mapAttrsToList
  27. (mac: name:
  28. let
  29. node = nodes.${name}.config.system.build;
  30. boot = installer.config.system.build;
  31. install = pkgs.writers.writeBash "install-${name}" ''
  32. set -o errexit
  33. set -o nounset
  34. set -o pipefail
  35. "${node.diskoScript}"
  36. "${node.nixos-install}/bin/nixos-install" \
  37. --root /mnt \
  38. --system "${node.toplevel}" \
  39. --no-channel-copy \
  40. --no-root-password \
  41. --verbose
  42. reboot
  43. '';
  44. in
  45. pkgs.writers.writeBashBin "pxe-install-${name}" ''
  46. exec ${pkgs.pixiecore}/bin/pixiecore \
  47. boot "${boot.kernel}/bzImage" "${boot.netbootRamdisk}/initrd" \
  48. --cmdline "init=${boot.toplevel}/init loglevel=4 nixos.install=${install}" \
  49. --debug \
  50. --dhcp-no-bind \
  51. --port 64172 \
  52. --status-port 64172 \
  53. "$@"
  54. '')
  55. targets;
  56. };
  57. in
  58. {
  59. environment.systemPackages = [ commands ];
  60. services.dhcpd4 = {
  61. enable = true;
  62. interfaces = [ "enp11s0f0" ];
  63. extraConfig = ''
  64. option domain-name-servers 10.0.0.53, 10.1.1.10;
  65. option domain-name "${config.networking.domain}";
  66. subnet 10.32.47.0 netmask 255.255.255.0 {
  67. interface enp11s0f0;
  68. range 10.32.47.200 10.32.47.230;
  69. option routers 10.32.47.1;
  70. }
  71. '';
  72. };
  73. networking.firewall = {
  74. allowedTCPPorts = [ 4011 64172 ];
  75. allowedUDPPorts = [ 67 69 ];
  76. };
  77. }