modules/hyprspace: use new config file format

This commit is contained in:
Max Headroom 2023-01-23 19:30:32 +01:00
parent a28f6eb487
commit d4dd78909f

View file

@ -3,10 +3,12 @@ let
inherit (config.networking) hostName;
inherit (inputs.depot.packages.${pkgs.system}) hyprspace;
hyprspaceCapableNodes = lib.filterAttrs (_: host: host ? hypr) hosts;
peersFormatted = builtins.mapAttrs (_: x: { "${x.hypr.addr}".id = x.hypr.id; }) hyprspaceCapableNodes;
peersFormatted = builtins.mapAttrs (_: x: {
inherit (x.hypr) id;
routes = map (net: { inherit net; }) ((x.hypr.routes or []) ++ [ "${x.hypr.addr}/32" ]);
}) hyprspaceCapableNodes;
peersFiltered = lib.filterAttrs (name: _: name != hostName) peersFormatted;
peers = lib.foldAttrs (n: _: n) null (builtins.attrValues peersFiltered);
peerList = lib.foldAttrs (n: _: n) null (builtins.attrValues peersFiltered);
peerList = builtins.attrValues peersFiltered;
myNode = hosts.${hostName};
listenPort = myNode.hypr.listenPort or 8001;
@ -22,7 +24,6 @@ let
private_key = "@HYPRSPACEPRIVATEKEY@";
};
peers = peerList;
inherit routes;
});
privateKeyFile = config.age.secrets.hyprspace-key.path;