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.
55 lines
1.3 KiB
55 lines
1.3 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)
|
|
];
|
|
};
|
|
|
|
canonical = mkOption {
|
|
description = ''
|
|
Canonical host name
|
|
'';
|
|
type = types.str;
|
|
default = config.networking.fqdn;
|
|
};
|
|
|
|
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 = (singleton config.hpc.hostFile.canonical) ++ 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));
|
|
};
|
|
}
|