diff --git a/cluster/services/ipfs/default.nix b/cluster/services/ipfs/default.nix index a2599cf..a7c875d 100644 --- a/cluster/services/ipfs/default.nix +++ b/cluster/services/ipfs/default.nix @@ -1,6 +1,24 @@ -{ tools, ... }: +{ config, lib, tools, ... }: { + hostLinks = lib.genAttrs config.services.ipfs.nodes.node (name: let + host = config.vars.hosts.${name}; + intf = host.interfaces.primary; + self = config.hostLinks.${name}.ipfs; + in { + ipfs = { + ipv4 = if intf ? addrPublic then intf.addrPublic else intf.addr; + port = 4001; + extra = { + peerId = { + VEGAS = "Qmd7QHZU8UjfYdwmjmq1SBh9pvER9AwHpfwQvnvNo3HBBo"; + prophet = "12D3KooWQWsHPUUeFhe4b6pyCaD1hBoj8j6Z7S7kTznRTh1p1eVt"; + }.${name}; + multiaddrTcp = "/ip4/${self.ipv4}/tcp/${self.portStr}/p2p/${self.extra.peerId}"; + multiaddrQuic = "/ip4/${self.ipv4}/udp/${self.portStr}/quic/p2p/${self.extra.peerId}"; + }; + }; + }); services.ipfs = { nodes = { node = [ "VEGAS" "prophet" ]; diff --git a/cluster/services/ipfs/node.nix b/cluster/services/ipfs/node.nix index 1fc9cfd..9069230 100644 --- a/cluster/services/ipfs/node.nix +++ b/cluster/services/ipfs/node.nix @@ -1,4 +1,4 @@ -{ aspect, config, inputs, lib, hosts, pkgs, tools, ... }: +{ aspect, cluster, config, inputs, lib, hosts, pkgs, tools, ... }: let inherit (tools.meta) domain; cfg = config.services.ipfs; @@ -56,6 +56,9 @@ in ]; Access-Control-Allow-Methods = [ "PUT" "POST" ]; }; + Peering.Peers = map + (name: cluster.config.hostLinks.${name}.ipfs.extra.multiaddrQuic) + cluster.config.services.ipfs.otherNodes.node; Gateway = { Writable = false; APICommands = [];