infra/nix/os/containers/syncthing.nix

46 lines
785 B
Nix
Raw Normal View History

{ hostAddress
, localAddress
, syncthingPort ? 22000
}:
{
config = { config, pkgs, ... }: {
imports = [
../profiles/containers/configuration.nix
];
networking.firewall.enable = true;
2019-03-06 13:53:37 +01:00
networking.firewall.allowedTCPPorts = [
# syncthing gui
8384
];
services.syncthing = {
enable = true;
openDefaultPorts = true;
2019-03-06 13:53:37 +01:00
guiAddress = "0.0.0.0:8384";
};
};
autoStart = true;
bindMounts = {
"/var/lib/syncthing/" = {
hostPath = "/var/lib/container-volumes/syncthing/var-lib-syncthing";
isReadOnly = false;
};
};
privateNetwork = true;
forwardPorts = [
{
containerPort = 22000;
hostPort = syncthingPort;
protocol = "tcp";
}
];
inherit hostAddress localAddress;
}