2.home-manager/tests/modules/services/syncthing/extra-options.nix
Austin Horstman 4883af6edb syncthing: avoid init for default gui address
The gui address option always has a default value, so #8644 ended up
making syncthing-init run for every enabled Syncthing setup.

Treat the default gui address as unset for updater purposes so the init
unit is only generated when Home Manager is actually managing Syncthing
configuration. Add regression tests for the default and explicit
guiAddress cases.
2026-04-26 19:44:29 -05:00

36 lines
1.1 KiB
Nix

{ lib, pkgs, ... }:
lib.mkMerge [
{
test.stubs.writers = {
extraAttrs.writeBash = (_name: _fn: "@syncthing-wrapper@");
};
services.syncthing = {
enable = true;
extraOptions = [
"-foo"
''-bar "baz"''
];
};
}
(lib.mkIf pkgs.stdenv.isLinux {
nmt.script = ''
assertFileExists home-files/.config/systemd/user/syncthing.service
assertPathNotExists home-files/.config/systemd/user/syncthing-init.service
assertPathNotExists home-files/.config/systemd/user/default.target.wants/syncthing-init.service
assertFileContains home-files/.config/systemd/user/syncthing.service \
"ExecStart=@syncthing@/bin/syncthing serve --no-browser --no-restart --no-upgrade '--gui-address=127.0.0.1:8384' -foo '-bar \"baz\"'"
'';
})
(lib.mkIf pkgs.stdenv.isDarwin {
nmt.script = ''
serviceFile=LaunchAgents/org.nix-community.home.syncthing.plist
assertFileExists "$serviceFile"
assertPathNotExists LaunchAgents/org.nix-community.home.syncthing-init.plist
assertFileContent "$serviceFile" ${./expected-agent.plist}
'';
})
]