cluster: restructure meshLinks

This commit is contained in:
Max Headroom 2024-08-23 01:06:38 +02:00
parent 4713febf4b
commit f55a60d0bb
6 changed files with 13 additions and 27 deletions

View file

@ -3,12 +3,14 @@
{
hostLinks = lib.pipe config.services [
(lib.filterAttrs (_: svc: svc.meshLinks != {}))
(lib.mapAttrsToList (svcName: svc: lib.mapAttrsToList (name: cfg: lib.genAttrs svc.nodes.${name} (hostName: {
${cfg.name} = { ... }: {
(lib.mapAttrsToList (svcName: svc:
lib.mapAttrsToList (groupName: links:
lib.genAttrs svc.nodes.${groupName} (hostName: lib.mapAttrs (_: cfg: { ... }: {
imports = [ cfg.link ];
ipv4 = config.vars.mesh.${hostName}.meshIp;
};
})) svc.meshLinks))
}) links)
) svc.meshLinks
))
(map lib.mkMerge)
lib.mkMerge
];

View file

@ -38,12 +38,8 @@ in
};
meshLinks = mkOption {
description = "Create host links on the mesh network.";
type = types.attrsOf (types.submodule ({ name, ... }: {
type = types.attrsOf (types.attrsOf (types.submodule {
options = {
name = mkOption {
type = types.str;
default = "${serviceName}-${name}";
};
link = mkOption {
type = types.deferredModule;
default = {};

View file

@ -16,10 +16,7 @@
./nar-serve.nix
];
};
meshLinks.server = {
name = "attic";
link.protocol = "http";
};
meshLinks.server.attic.link.protocol = "http";
secrets = let
inherit (config.services.attic) nodes;
in {

View file

@ -4,10 +4,7 @@
services.forge = {
nodes.server = [ "VEGAS" ];
nixos.server = ./server.nix;
meshLinks.server = {
name = "forge";
link.protocol = "http";
};
meshLinks.server.forge.link.protocol = "http";
secrets = with config.services.forge.nodes; {
oidcSecret = {
nodes = server;

View file

@ -29,10 +29,7 @@
io-tweaks = [ "VEGAS" ];
remote-api = [ "VEGAS" ];
};
meshLinks.gateway = {
name = "ipfsGateway";
link.protocol = "http";
};
meshLinks.gateway.ipfsGateway.link.protocol = "http";
nixos = {
node = [
./node.nix

View file

@ -66,10 +66,7 @@ in
./tracing.nix
];
};
meshLinks.logging = {
name = "loki";
link.protocol = "http";
};
meshLinks.logging.loki.link.protocol = "http";
};
garage = config.lib.forService "monitoring" {