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.

70 lines
1.6 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. };
  10. installer = pkgs.nixos [
  11. ./installer.nix
  12. {
  13. _module.args = {
  14. manangerConfig = config;
  15. };
  16. }
  17. ];
  18. commands = pkgs.symlinkJoin {
  19. name = "pxeboot";
  20. paths = mapAttrsToList
  21. (mac: name:
  22. let
  23. node = nodes.${name}.config.system.build;
  24. boot = installer.config.system.build;
  25. install = pkgs.writers.writeBash "install-${name}" ''
  26. set -o errexit
  27. set -o nounset
  28. set -o pipefail
  29. "${node.diskoScript}"
  30. "${node.nixos-install}/bin/nixos-install" \
  31. --root /mnt \
  32. --system "${node.toplevel}" \
  33. --no-channel-copy \
  34. --no-root-password \
  35. --verbose
  36. reboot
  37. '';
  38. in
  39. pkgs.writers.writeBashBin "pxe-install-${name}" ''
  40. exec ${pkgs.pixiecore}/bin/pixiecore \
  41. boot "${boot.kernel}/bzImage" "${boot.netbootRamdisk}/initrd" \
  42. --cmdline "init=${boot.toplevel}/init loglevel=4 nixos.install=${install}" \
  43. --debug \
  44. --dhcp-no-bind \
  45. --port 64172 \
  46. --status-port 64172 \
  47. "$@"
  48. '')
  49. targets;
  50. };
  51. in
  52. {
  53. environment.systemPackages = [ commands ];
  54. networking.firewall = {
  55. allowedTCPPorts = [ 4011 64172 ];
  56. allowedUDPPorts = [ 67 69 ];
  57. };
  58. }