cluster: restructure meshLinks
This commit is contained in:
parent
4713febf4b
commit
f55a60d0bb
6 changed files with 13 additions and 27 deletions
|
@ -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} = { ... }: {
|
||||
imports = [ cfg.link ];
|
||||
ipv4 = config.vars.mesh.${hostName}.meshIp;
|
||||
};
|
||||
})) svc.meshLinks))
|
||||
(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;
|
||||
}) links)
|
||||
) svc.meshLinks
|
||||
))
|
||||
(map lib.mkMerge)
|
||||
lib.mkMerge
|
||||
];
|
||||
|
|
|
@ -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 = {};
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" {
|
||||
|
|
Loading…
Reference in a new issue