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.
64 lines
1.4 KiB
64 lines
1.4 KiB
{ pkgs, lib, config, modulesPath, manangerConfig, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
auto-install = pkgs.writeShellScript "nixos-install" ''
|
|
if [[ "$(cat /proc/cmdline)" =~ nixos\.install=([^ ]+) ]]; then
|
|
INSTALL="''${BASH_REMATCH[1]}"
|
|
else
|
|
echo "No install derivation found" >&2
|
|
exit 1
|
|
fi
|
|
'';
|
|
in
|
|
{
|
|
imports = [
|
|
"${modulesPath}/installer/netboot/netboot-minimal.nix"
|
|
];
|
|
|
|
config = {
|
|
services.getty.autologinUser = lib.mkForce "root";
|
|
|
|
networking.hostName = "installer";
|
|
networking.hosts = mkForce manangerConfig.networking.hosts;
|
|
|
|
users.users."root" = mkForce manangerConfig.users.users."root";
|
|
|
|
systemd.services."auto-install" = {
|
|
description = "Automated NixOS installer";
|
|
|
|
wants = [ "network-online.target" ];
|
|
after = [ "network-online.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
unitConfig = {
|
|
AssertKernelCommandLine = "nixos.install";
|
|
|
|
FailureAction = "reboot-force";
|
|
};
|
|
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
|
|
ExecStart = auto-install;
|
|
|
|
StandardInput = "tty-force";
|
|
TTYPath = "/dev/tty1";
|
|
TTYVTDisallocate = false;
|
|
};
|
|
};
|
|
|
|
nix.settings = {
|
|
substituters = [
|
|
"http://cache.${manangerConfig.networking.domain}"
|
|
];
|
|
trusted-public-keys = [
|
|
(fileContents manangerConfig.gather.parts."cache/key".path)
|
|
];
|
|
};
|
|
|
|
system.stateVersion = config.system.nixos.release;
|
|
};
|
|
}
|