diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix index b6cebfa5f..a17c54ed2 100644 --- a/modules/services/syncthing.nix +++ b/modules/services/syncthing.nix @@ -49,6 +49,15 @@ in { description = "Syncthing tray command to use."; }; + extraOptions = mkOption { + type = types.listOf types.str; + default = [ ]; + example = [ "--wait" ]; + description = '' + Extra command-line arguments to pass to {command}`syncthingtray`. + ''; + }; + package = mkOption { type = types.package; default = pkgs.syncthingtray-minimal; @@ -126,7 +135,9 @@ in { }; Service = { - ExecStart = "${cfg.tray.package}/bin/${cfg.tray.command}"; + ExecStart = escapeShellArgs + ([ "${cfg.tray.package}/bin/${cfg.tray.command}" ] + ++ cfg.tray.extraOptions); }; Install = { WantedBy = [ "graphical-session.target" ]; }; diff --git a/tests/modules/services/syncthing/linux/tray.nix b/tests/modules/services/syncthing/linux/tray.nix index 5ff3c2841..934de5b84 100644 --- a/tests/modules/services/syncthing/linux/tray.nix +++ b/tests/modules/services/syncthing/linux/tray.nix @@ -4,7 +4,12 @@ with lib; { config = { - services.syncthing.tray.enable = true; + services.syncthing.tray = { + enable = true; + extraOptions = [ "--wait" ]; + }; + + test.stubs.syncthingtray = { }; nixpkgs.overlays = [ (self: super: { @@ -16,6 +21,7 @@ with lib; nmt.script = '' assertFileExists home-files/.config/systemd/user/syncthingtray.service + assertFileContains home-files/.config/systemd/user/syncthingtray.service "ExecStart='@syncthingtray@/bin/syncthingtray' '--wait'" ''; }; }