Skip to content

Commit

Permalink
nixos/syncthing: fix syncthing-init running by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Lassulus committed May 22, 2023
1 parent 0183d54 commit 5724058
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions nixos/modules/services/networking/syncthing.nix
Original file line number Diff line number Diff line change
Expand Up @@ -131,32 +131,32 @@ in {
freeformType = settingsFormat.type;
options = {
localAnnounceEnabled = mkOption {
type = types.bool;
default = true;
type = types.nullOr types.bool;
default = null;
description = lib.mdDoc ''
Whether to send announcements to the local LAN, also use such announcements to find other devices.
'';
};

localAnnouncePort = mkOption {
type = types.int;
default = 21027;
type = types.nullOr types.int;
default = null;
description = lib.mdDoc ''
The port on which to listen and send IPv4 broadcast announcements to.
'';
};

relaysEnabled = mkOption {
type = types.bool;
default = true;
type = types.nullOr types.bool;
default = null;
description = lib.mdDoc ''
When true, relays will be connected to and potentially used for device to device connections.
'';
};

urAccepted = mkOption {
type = types.int;
default = 0;
type = types.nullOr types.int;
default = null;
description = lib.mdDoc ''
Whether the user has accepted to submit anonymous usage data.
The default, 0, mean the user has not made a choice, and Syncthing will ask at some point in the future.
Expand All @@ -165,16 +165,16 @@ in {
};

limitBandwidthInLan = mkOption {
type = types.bool;
default = false;
type = types.nullOr types.bool;
default = null;
description = lib.mdDoc ''
Whether to apply bandwidth limits to devices in the same broadcast domain as the local device.
'';
};

maxFolderConcurrency = mkOption {
type = types.int;
default = 0;
type = types.nullOr types.int;
default = null;
description = lib.mdDoc ''
This option controls how many folders may concurrently be in I/O-intensive operations such as syncing or scanning.
The mechanism is described in detail in a [separate chapter](https://docs.syncthing.net/advanced/option-max-concurrency.html).
Expand Down Expand Up @@ -615,7 +615,10 @@ in {
];
};
};
syncthing-init = mkIf (cfg.settings != {}) {
syncthing-init = mkIf (
# we filter all the null values out to easier compare the two sets
(lib.filterAttrsRecursive (_: v: v != null) cfg.settings) != { devices = {}; folders = {}; options = {}; }
) {
description = "Syncthing configuration updater";
requisite = [ "syncthing.service" ];
after = [ "syncthing.service" ];
Expand Down

0 comments on commit 5724058

Please sign in to comment.