xin/configs/peerix.nix

44 lines
1002 B
Nix
Raw Normal View History

2022-08-30 15:55:21 -06:00
{ config, lib, ... }:
with lib; {
options = {
2022-08-30 15:56:37 -06:00
tsPeerix = {
2022-08-30 15:55:21 -06:00
enable = mkOption {
description = "Enable peerix";
default = false;
example = true;
type = lib.types.bool;
};
privateKeyFile = mkOption {
description = "Private key file for signing";
default = "";
example = "./private_key";
type = lib.types.path;
};
};
};
2022-08-30 15:56:37 -06:00
config = mkIf config.tsPeerix.enable {
2022-08-30 15:58:26 -06:00
users.groups.peerix = { name = "peerix"; };
2022-08-30 15:56:37 -06:00
users.users.peerix = {
name = "peerix";
group = "peerix";
isSystemUser = true;
};
2022-08-30 15:55:21 -06:00
services = {
peerix = {
enable = true;
2022-08-30 15:56:37 -06:00
openFirewall = false;
user = "peerix";
privateKeyFile = "${config.tsPeerix.privateKeyFile}";
publicKeyFile = ./peerix.pubs;
2022-08-30 15:55:21 -06:00
};
};
networking.firewall.interfaces = {
"tailscale0" = {
2022-08-30 15:56:37 -06:00
allowedUDPPorts = [ 12304 ];
allowedTCPPorts = [ 12304 ];
2022-08-30 15:55:21 -06:00
};
};
};
}