chore(monitoring): separate external machines

This commit is contained in:
arcnmx 2024-06-01 14:57:57 -07:00
parent d5fb12ad9a
commit bd6f16cd4f
4 changed files with 23 additions and 8 deletions

View file

@ -206,11 +206,20 @@ in {
default = domain; default = domain;
}; };
global.enable = mkEnableOption "globally routeable"; global.enable = mkEnableOption "globally routeable";
online.enable = online = let
proxmoxNodeAccess = systems.${config.proxmox.node.name}.config.access;
in {
enable =
mkEnableOption "a deployed machine" mkEnableOption "a deployed machine"
// { // {
default = true; default = true;
}; };
available =
mkEnableOption "always on machine"
// {
default = cfg.online.enable && (config.type == "NixOS" || config.proxmox.node.enable || (config.proxmox.vm.enable && proxmoxNodeAccess.online.available));
};
};
hostnameForNetwork = mkOption { hostnameForNetwork = mkOption {
type = attrsOf str; type = attrsOf str;
default = {}; default = {};

View file

@ -249,7 +249,7 @@ in
enable = enable =
mkEnableOption "health check alerts" mkEnableOption "health check alerts"
// { // {
default = config.access.online.enable && config.type == "NixOS"; default = config.access.online.enable && config.access.online.available;
}; };
}; };
services = mkOption { services = mkOption {

View file

@ -157,12 +157,15 @@
}; };
groups = { groups = {
services = "Services"; services = "Services";
servers = "${groups.systems}/Servers";
systems = "Systems"; systems = "Systems";
forSystem = system: let forSystem = system: let
node = systems.${system.config.proxmox.node.name}.config; node = systems.${system.config.proxmox.node.name}.config;
in in
if system.config.proxmox.enabled if system.config.proxmox.enabled
then "${groups.systems}/${node.name}" then "${groups.servers}/${node.name}"
else if system.config.access.online.available
then groups.servers
else groups.systems; else groups.systems;
}; };
in { in {

View file

@ -1,6 +1,9 @@
_: { _: {
type = "Linux"; type = "Linux";
access.hostName = "u7-pro"; access = {
hostName = "u7-pro";
online.available = true;
};
network.networks = { network.networks = {
local = { local = {
address4 = "10.1.1.3"; address4 = "10.1.1.3";