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 [
|
hostLinks = lib.pipe config.services [
|
||||||
(lib.filterAttrs (_: svc: svc.meshLinks != {}))
|
(lib.filterAttrs (_: svc: svc.meshLinks != {}))
|
||||||
(lib.mapAttrsToList (svcName: svc: lib.mapAttrsToList (name: cfg: lib.genAttrs svc.nodes.${name} (hostName: {
|
(lib.mapAttrsToList (svcName: svc:
|
||||||
${cfg.name} = { ... }: {
|
lib.mapAttrsToList (groupName: links:
|
||||||
|
lib.genAttrs svc.nodes.${groupName} (hostName: lib.mapAttrs (_: cfg: { ... }: {
|
||||||
imports = [ cfg.link ];
|
imports = [ cfg.link ];
|
||||||
ipv4 = config.vars.mesh.${hostName}.meshIp;
|
ipv4 = config.vars.mesh.${hostName}.meshIp;
|
||||||
};
|
}) links)
|
||||||
})) svc.meshLinks))
|
) svc.meshLinks
|
||||||
|
))
|
||||||
(map lib.mkMerge)
|
(map lib.mkMerge)
|
||||||
lib.mkMerge
|
lib.mkMerge
|
||||||
];
|
];
|
||||||
|
|
|
@ -38,12 +38,8 @@ in
|
||||||
};
|
};
|
||||||
meshLinks = mkOption {
|
meshLinks = mkOption {
|
||||||
description = "Create host links on the mesh network.";
|
description = "Create host links on the mesh network.";
|
||||||
type = types.attrsOf (types.submodule ({ name, ... }: {
|
type = types.attrsOf (types.attrsOf (types.submodule {
|
||||||
options = {
|
options = {
|
||||||
name = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "${serviceName}-${name}";
|
|
||||||
};
|
|
||||||
link = mkOption {
|
link = mkOption {
|
||||||
type = types.deferredModule;
|
type = types.deferredModule;
|
||||||
default = {};
|
default = {};
|
||||||
|
|
|
@ -16,10 +16,7 @@
|
||||||
./nar-serve.nix
|
./nar-serve.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
meshLinks.server = {
|
meshLinks.server.attic.link.protocol = "http";
|
||||||
name = "attic";
|
|
||||||
link.protocol = "http";
|
|
||||||
};
|
|
||||||
secrets = let
|
secrets = let
|
||||||
inherit (config.services.attic) nodes;
|
inherit (config.services.attic) nodes;
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -4,10 +4,7 @@
|
||||||
services.forge = {
|
services.forge = {
|
||||||
nodes.server = [ "VEGAS" ];
|
nodes.server = [ "VEGAS" ];
|
||||||
nixos.server = ./server.nix;
|
nixos.server = ./server.nix;
|
||||||
meshLinks.server = {
|
meshLinks.server.forge.link.protocol = "http";
|
||||||
name = "forge";
|
|
||||||
link.protocol = "http";
|
|
||||||
};
|
|
||||||
secrets = with config.services.forge.nodes; {
|
secrets = with config.services.forge.nodes; {
|
||||||
oidcSecret = {
|
oidcSecret = {
|
||||||
nodes = server;
|
nodes = server;
|
||||||
|
|
|
@ -29,10 +29,7 @@
|
||||||
io-tweaks = [ "VEGAS" ];
|
io-tweaks = [ "VEGAS" ];
|
||||||
remote-api = [ "VEGAS" ];
|
remote-api = [ "VEGAS" ];
|
||||||
};
|
};
|
||||||
meshLinks.gateway = {
|
meshLinks.gateway.ipfsGateway.link.protocol = "http";
|
||||||
name = "ipfsGateway";
|
|
||||||
link.protocol = "http";
|
|
||||||
};
|
|
||||||
nixos = {
|
nixos = {
|
||||||
node = [
|
node = [
|
||||||
./node.nix
|
./node.nix
|
||||||
|
|
|
@ -66,10 +66,7 @@ in
|
||||||
./tracing.nix
|
./tracing.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
meshLinks.logging = {
|
meshLinks.logging.loki.link.protocol = "http";
|
||||||
name = "loki";
|
|
||||||
link.protocol = "http";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
garage = config.lib.forService "monitoring" {
|
garage = config.lib.forService "monitoring" {
|
||||||
|
|
Loading…
Reference in a new issue