Syncthing - listenAddress and globalAnnounceServer

So I’ve got the majority of the settings working just fine. Once the configuration is built, I can manually change listen address and globalAnnounceServer and it works fine but defining it in the nix configuration isn’t working.

I’ve verified that the config.xml that is generated for syncthing has the default settings for listen address. I’m a bit of a noob and not sure where to look as far as a log of the build process specifically for the syncthing package. Below is my configuration. The Syncthing settings I’m trying to define are the global discovery server and listen address.

thanks in advance for any help!

  # configure the configurations and settings
  services.syncthing.settings.options = {
    localAnnouncePort = 21027;
    localAnnounceEnabled = true;
    guiAddress = "0.0.0.0:8384";
    urAccepted = -1;
    gui = {
     user = "testing";
     password = "testing";
     theme = "black";
    };
    options = {
      listenAddress = [
  "relay://host.domain.tld:22067/?id=stuffgoeshere"
  "tcp4://10.0.1.27:22000"
      ];
      minHomeDiskFree = {
  unit = "%";
  value = 1;
      };
      globalAnnounceServer = [
  "https://host.domain.tld:3448/?id=stuffghoeshere"
      ];
    };
  };

It looks like you’ve got an extra layer of settings and too many options blocks.

services.syncthing = {
  enable = true;
  settings = {
    options = {
      localAnnouncePort = 21027;
      ...
      globalAnnounceServer = ....
    };
  };
};

I’ve changed it to this. It picks up the listenAddress variable and sets it in the config.xml but not the global discovery server. I’m assuming that’s a Syncthing only configuration setting that’s not available in the options of nixpkgs?

# syncthing configuration
  services.syncthing = {
    enable = true;
    user = "syncthing";
    dataDir = "/home/syncthing/";
    configDir = "/home/syncthing/.config";
  };
  
  # configure the configurations and settings
  services.syncthing.settings.options = {
      localAnnouncePort = 21027;
      localAnnounceEnabled = true;
      listenAddresses = [
        "relay://host.domain.tld:22067/?id=stuffgoeshere"
        "tcp4://10.0.1.27:22000"
      ];
      globalAnnounceServer = [ "https://host.domain.tld:3448/?id=stuffgoeshere" ];
 
  }; 

  services.syncthing.settings = {
    gui = {
      user = "testing";
      password = "testing";
      theme = "black";
    };
   };
   services.syncthing.settings.options.urAccepted = -1;

Everything under ....settings is specific to the application and will not be findable via nixos option search yes. You’ll have to read the docs for the app itself to know how to configure it.

1 Like

Expanding on what @waffle8946 wrote you arent to have a look here: Syncthing Configuration — Syncthing documentation. It should be quite obvious that the attribute sets are mapped to xml.

1 Like