ipfs: remove modes

This commit is contained in:
Sean Buckley 2022-02-17 22:58:04 -05:00
parent ad78983ef3
commit 0098774d8f

View file

@ -1,33 +1,10 @@
{ config, lib, pkgs, ... }:
let
cfg = config.sconfig.ipfs;
modes = {
server = {
AutoNAT.ServiceMode = "disabled"; # maybe change this to "enabled" ?
Reprovider.Strategy = "pinned";
Routing.Type = "dhtclient"; # maybe change this to "dht" ?
Swarm.ConnMgr.HighWater = 900;
Swarm.ConnMgr.LowWater = 600;
Swarm.DisableNatPortMap = true; # Disable UPnP
};
desktop = {
AutoNAT.ServiceMode = "disabled";
Reprovider.Strategy = "pinned";
Routing.Type = "dhtclient";
Swarm.ConnMgr.HighWater = 300;
Swarm.ConnMgr.LowWater = 50;
Swarm.DisableNatPortMap = true; # Disable UPnP
};
};
in
{
options.sconfig.ipfs = {
enable = lib.mkEnableOption "Turn on IPFS";
mode = lib.mkOption { type = lib.types.enum [ "server" "desktop" ]; };
};
config = lib.mkIf cfg.enable {
@ -35,10 +12,17 @@ in
services.ipfs = {
enable = true;
emptyRepo = true;
extraConfig = modes.${cfg.mode};
gatewayAddress = "/ip4/127.0.0.1/tcp/8001";
# Had issues without fdlimit. 65536 value taken from nixpkgs example
serviceFdlimit = 65536;
extraConfig = {
AutoNAT.ServiceMode = "disabled"; # maybe "enabled" for servers?
Reprovider.Strategy = "pinned";
Routing.Type = "dhtclient"; # maybe "dht" for servers?
Swarm.ConnMgr.HighWater = 1000;
Swarm.ConnMgr.LowWater = 50;
Swarm.DisableNatPortMap = true; # Disable UPnP
};
};
systemd.services.ipfs.postStart = ''