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
69 lines
1.7 KiB
# TFTP boot with shared image
|
|
# Requests store path to install from master
|
|
# Runs disko and nixos-install
|
|
|
|
{ pkgs, lib, config, nodes, ... }@args:
|
|
|
|
with lib;
|
|
|
|
let
|
|
targets = {
|
|
"50:46:5d:da:0b:d6" = "node-00";
|
|
};
|
|
|
|
installer = pkgs.nixos [
|
|
./installer.nix
|
|
{
|
|
_module.args = {
|
|
manangerConfig = config;
|
|
};
|
|
}
|
|
];
|
|
|
|
api = pkgs.linkFarm "pixiecore-api" (mapAttrs'
|
|
(mac: name: nameValuePair
|
|
"v1/boot/${mac}"
|
|
(pkgs.writeText "pixieboot-api-${name}" (
|
|
let
|
|
boot = installer.config.system.build;
|
|
node = nodes.${name}.config.system.build;
|
|
in
|
|
builtins.toJSON {
|
|
kernel = "file://${boot.kernel}/bzImage";
|
|
initrd = "file://${boot.netbootRamdisk}/initrd";
|
|
cmdline = concatStringsSep "\n" [
|
|
"init=${boot.toplevel}/init"
|
|
"loglevel=4"
|
|
"nixos.install=${node.toplevel}"
|
|
];
|
|
message = "NixOS Automatic Installer for ${name}";
|
|
}
|
|
)))
|
|
targets);
|
|
in
|
|
{
|
|
services.pixiecore = {
|
|
enable = true;
|
|
mode = "api";
|
|
dhcpNoBind = true;
|
|
debug = true;
|
|
openFirewall = true;
|
|
port = 5080;
|
|
statusPort = 6080;
|
|
apiServer = "http://boot.${config.networking.domain}/pixiecore";
|
|
};
|
|
|
|
services.nginx = {
|
|
virtualHosts = {
|
|
"boot.${config.networking.domain}" = {
|
|
locations."/".proxyPass = "http://localhost:${toString config.services.pixiecore.port}";
|
|
locations."/status".proxyPass = "http://localhost:${toString config.services.pixiecore.statusPort}";
|
|
locations."/pixiecore".root = api;
|
|
};
|
|
};
|
|
};
|
|
|
|
hpc.hostFile.aliases = [
|
|
"boot.${config.networking.domain}"
|
|
];
|
|
}
|