infra: steal from the best
(Mic92's cluster TUM's infra.)
This commit is contained in:
parent
41aead1a04
commit
107cc6e53f
22 changed files with 951 additions and 0 deletions
47
modules/hosts.nix
Normal file
47
modules/hosts.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
hostOptions = with lib; {
|
||||
ipv4 = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
own ipv4 address
|
||||
'';
|
||||
};
|
||||
|
||||
ipv6 = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
own ipv6 address
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options = with lib; {
|
||||
networking.newtype.hosts = mkOption {
|
||||
type = with types; attrsOf (submodule [{ options = hostOptions; }]);
|
||||
description = "A host in our cluster";
|
||||
};
|
||||
networking.newtype.currentHost = mkOption {
|
||||
type = with types; submodule [{ options = hostOptions; }];
|
||||
default = config.networking.newtype.hosts.${config.networking.hostName};
|
||||
description = "The host that is described by this configuration";
|
||||
};
|
||||
};
|
||||
config = {
|
||||
warnings =
|
||||
lib.optional (!(config.networking.newtype.hosts ? ${config.networking.hostName}) &&
|
||||
config.networking.hostName != "nixos" # we dont care about nixos netboot/installer images
|
||||
)
|
||||
"Please add network configuration for ${config.networking.hostName}. None found in ${./hosts.nix}";
|
||||
|
||||
# usually, for each host there is a hostname.dse.in.tum.de and hostname.r domain
|
||||
networking.newtype.hosts = {
|
||||
epyc = {
|
||||
ipv6 = "2001:470:ca5e:dee:587c:7a50:f36c:cae8";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in a new issue