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

# 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";
"50:46:5d:da:0c:56" = "node-01";
"50:46:5d:da:0c:52" = "node-02";
"10:bf:48:1f:a6:8f" = "node-03";
# "10:bf:48:1b:57:47" = "node-04";
# "10:bf:48:19:a2:4d" = "node-05";
# "10:bf:48:1b:56:df" = "node-06";
};
installer = pkgs.nixos [
./installer.nix
{
_module.args = {
managerConfig = config;
};
}
];
commands = pkgs.symlinkJoin {
name = "pxeboot";
paths = mapAttrsToList
(mac: name:
let
node = nodes.${name}.config.system.build;
boot = installer.config.system.build;
install = pkgs.writers.writeBash "install-${name}" ''
set -o errexit
set -o nounset
set -o pipefail
"${node.diskoScript}"
"${node.nixos-install}/bin/nixos-install" \
--root /mnt \
--system "${node.toplevel}" \
--no-channel-copy \
--no-root-password \
--verbose
reboot
'';
in
pkgs.writers.writeBashBin "pxe-install-${name}" ''
exec ${pkgs.pixiecore}/bin/pixiecore \
boot "${boot.kernel}/bzImage" "${boot.netbootRamdisk}/initrd" \
--cmdline "init=${boot.toplevel}/init loglevel=4 nixos.install=${install}" \
--debug \
--dhcp-no-bind \
--port 64172 \
--status-port 64172 \
"$@"
'')
targets;
};
in
{
environment.systemPackages = [ commands ];
services.dhcpd4 = {
enable = true;
interfaces = [ "enp11s0f0" ];
extraConfig = ''
option domain-name-servers 10.0.0.53, 10.1.1.10;
option domain-name "${config.networking.domain}";
subnet 10.32.47.0 netmask 255.255.255.0 {
interface enp11s0f0;
range 10.32.47.200 10.32.47.230;
option routers 10.32.47.1;
}
'';
};
networking.firewall = {
allowedTCPPorts = [ 4011 64172 ];
allowedUDPPorts = [ 67 69 ];
};
}