mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 17:31:34 +01:00
Set syncthing ports with options
This commit is contained in:
parent
5c152b3948
commit
af3d333395
1 changed files with 11 additions and 2 deletions
|
|
@ -16,6 +16,14 @@ in
|
||||||
type = lib.types.nonEmptyStr;
|
type = lib.types.nonEmptyStr;
|
||||||
default = "";
|
default = "";
|
||||||
};
|
};
|
||||||
|
syncPort = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 22000;
|
||||||
|
};
|
||||||
|
guiPort = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 8384;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
@ -33,7 +41,7 @@ in
|
||||||
group = lib.mkIf (!cfg.isServer) "users";
|
group = lib.mkIf (!cfg.isServer) "users";
|
||||||
dataDir = lib.mkIf (!cfg.isServer) "/home/seb";
|
dataDir = lib.mkIf (!cfg.isServer) "/home/seb";
|
||||||
|
|
||||||
guiAddress = lib.mkIf cfg.isServer "0.0.0.0:8384";
|
guiAddress = lib.mkIf cfg.isServer "0.0.0.0:${toString cfg.guiPort}";
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
# Get the devices and their ids from the configs of the other hosts
|
# Get the devices and their ids from the configs of the other hosts
|
||||||
|
|
@ -44,7 +52,7 @@ in
|
||||||
|> lib.mapAttrs (
|
|> lib.mapAttrs (
|
||||||
name: value: {
|
name: value: {
|
||||||
id = value.config.custom.services.syncthing.deviceId;
|
id = value.config.custom.services.syncthing.deviceId;
|
||||||
addresses = [ "tcp://${name}.${tailscaleCfg.domain}:22000" ];
|
addresses = [ "tcp://${name}.${tailscaleCfg.domain}:${toString cfg.syncPort}" ];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -68,6 +76,7 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
listenAddress = "tcp://0.0.0.0:${toString cfg.syncPort}";
|
||||||
globalAnnounceEnabled = false;
|
globalAnnounceEnabled = false;
|
||||||
localAnnounceEnabled = false;
|
localAnnounceEnabled = false;
|
||||||
relaysEnabled = false;
|
relaysEnabled = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue