nixos/modules/ipfs/ipfs-cluster.nix

39 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2026-09-26 14:17:59 +02:00
{
lib,
pkgs,
config,
...
}:
{
services.ipfs-cluster = {
enable = true;
consensus = "crdt";
2026-09-26 14:17:59 +02:00
secretFile = "/run/secrets/ipfs-cluster-key";
# ipfs-cluster-init.service generates its own id and adds other ids as trusted/peers/bootstrap peers
# in $IPFS_CLUSTER_PATH/peerstore - for the peers to connect to on start
# in $IPFS_CLUSTER_PATH/services.json - for the peers to trust
# in $IPFS_CLUSTER_PATH/identity.json - for the new machine's peerId to then add to trusted peers
# TODO find a way to generate this ID manually and set it per-machine, instead of retrieving it from
# a generated config and adding it back manually to every other peer...
initPeers = [
"/dns4/zomelab.taila38157.ts.net/tcp/9096/p2p/12D3KooWPnNjUKE88B9dZR6J4SkWTjD5uVFFfgUFypdXThrZxaLR"
"/dns4/niczos.taila38157.ts.net/tcp/9096/p2p/12D3KooWETrrcBP9Jw8L2Dwd9ywMWkShGqsveSd8fvd3ZyYeZmS9"
];
};
# Inject debug flag in ipfs-cluster ExecStart
systemd.services.ipfs-cluster.serviceConfig.ExecStart = lib.mkForce [
"${lib.getExe' pkgs.ipfs-cluster "ipfs-cluster-service"} -l debug daemon"
];
sops.secrets.ipfs-cluster-key = {
sopsFile = /etc/nixos/modules/ipfs/keys/ipfs-cluster-key.yaml;
mode = "0060";
owner = "nobody";
group = config.services.kubo.group;
};
networking.firewall.interfaces."tailscale0".allowedTCPPorts = [
9096
];
}