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.

69 lines
1.7 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. api = pkgs.linkFarm "pixiecore-api" (mapAttrs'
  19. (mac: name: nameValuePair
  20. "v1/boot/${mac}"
  21. (pkgs.writeText "pixieboot-api-${name}" (
  22. let
  23. boot = installer.config.system.build;
  24. node = nodes.${name}.config.system.build;
  25. in
  26. builtins.toJSON {
  27. kernel = "file://${boot.kernel}/bzImage";
  28. initrd = "file://${boot.netbootRamdisk}/initrd";
  29. cmdline = concatStringsSep "\n" [
  30. "init=${boot.toplevel}/init"
  31. "loglevel=4"
  32. "nixos.install=${node.toplevel}"
  33. ];
  34. message = "NixOS Automatic Installer for ${name}";
  35. }
  36. )))
  37. targets);
  38. in
  39. {
  40. services.pixiecore = {
  41. enable = true;
  42. mode = "api";
  43. dhcpNoBind = true;
  44. debug = true;
  45. openFirewall = true;
  46. port = 5080;
  47. statusPort = 6080;
  48. apiServer = "http://boot.${config.networking.domain}/pixiecore";
  49. };
  50. services.nginx = {
  51. virtualHosts = {
  52. "boot.${config.networking.domain}" = {
  53. locations."/".proxyPass = "http://localhost:${toString config.services.pixiecore.port}";
  54. locations."/status".proxyPass = "http://localhost:${toString config.services.pixiecore.statusPort}";
  55. locations."/pixiecore".root = api;
  56. };
  57. };
  58. };
  59. hpc.hostFile.aliases = [
  60. "boot.${config.networking.domain}"
  61. ];
  62. }