modules/hyprspace: add route configuration support

This commit is contained in:
Max Headroom 2022-10-08 12:08:34 +02:00
parent 16e4664899
commit d2674bdb5a

View file

@ -9,6 +9,9 @@ let
myNode = hosts.${hostName}; myNode = hosts.${hostName};
listenPort = myNode.hypr.listenPort or 8001; listenPort = myNode.hypr.listenPort or 8001;
routes' = map (x: lib.genAttrs (x.hypr.routes or []) (_: { ip = x.hypr.addr; })) (builtins.attrValues hyprspaceCapableNodes);
routes = builtins.foldl' (x: y: x // y) {} (lib.flatten routes');
interfaceConfig = pkgs.writeText "hyprspace.yml" (builtins.toJSON { interfaceConfig = pkgs.writeText "hyprspace.yml" (builtins.toJSON {
interface = { interface = {
name = "hyprspace"; name = "hyprspace";
@ -18,6 +21,7 @@ let
private_key = "@HYPRSPACEPRIVATEKEY@"; private_key = "@HYPRSPACEPRIVATEKEY@";
}; };
peers = peerList; peers = peerList;
inherit routes;
}); });
privateKeyFile = config.age.secrets.hyprspace-key.path; privateKeyFile = config.age.secrets.hyprspace-key.path;