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.
 
 
 

47 lines
1.1 KiB

{ pkgs, lib, config, nodes, ... }:
with lib;
{
options.hpc.hostFile = {
addresses = mkOption {
description = ''
IP addresses of this host
'';
type = types.listOf types.str;
default =
let
interface = config.networking.interfaces.${config.networking.defaultGateway.interface};
in
concatLists [
(map (e: e.address) interface.ipv4.addresses)
(map (e: e.address) interface.ipv6.addresses)
];
};
aliases = mkOption {
description = ''
Aliases for this host
'';
type = types.listOf types.str;
default = [ ];
};
entries = mkOption {
description = ''
Host name entries for this host
'';
type = types.listOf types.str;
readOnly = true;
default = [ config.networking.fqdn config.networking.hostName ] ++ config.hpc.hostFile.aliases;
};
};
config = {
networking.hosts = listToAttrs (concatMap
(node: map
(address: nameValuePair address node.config.hpc.hostFile.entries)
node.config.hpc.hostFile.addresses)
(attrValues nodes));
};
}