mirror of
https://github.com/nix-community/home-manager
synced 2024-12-05 01:19:46 +01:00
a42fa14b53
This expands the Syncthing configuration to allow declarative settings. Code mostly pulled from the Nixpkgs module. Changes compared to the NixOS module are: Removed the following options: - user, group, systemService: Unnecessary since Syncthing always runs as the user declaring the configuration. - dataDir configDir, databaseDir: Pointed to ~/.local/state/syncthing, the default Syncthing directory. - openDefaultPorts: We don't have access to the system firewall. Furthermore, multiple changes to systemd services were made to maintain consistency with other Home Manager modules, sandboxing options might need to be reviewed further. Fixes #4049
26 lines
783 B
Nix
26 lines
783 B
Nix
{ lib, pkgs, ... }:
|
|
|
|
lib.mkMerge [
|
|
{
|
|
services.syncthing = {
|
|
enable = true;
|
|
extraOptions = [ "-foo" ''-bar "baz"'' ];
|
|
};
|
|
|
|
test.stubs.syncthing = { };
|
|
}
|
|
(lib.mkIf pkgs.stdenv.isLinux {
|
|
nmt.script = ''
|
|
assertFileExists home-files/.config/systemd/user/syncthing.service
|
|
assertFileContains home-files/.config/systemd/user/syncthing.service \
|
|
"ExecStart=@syncthing@/bin/syncthing -no-browser -no-restart -no-upgrade '-gui-address=127.0.0.1:8384' '-logflags=0' -foo '-bar \"baz\"'"
|
|
'';
|
|
})
|
|
(lib.mkIf pkgs.stdenv.isDarwin {
|
|
nmt.script = ''
|
|
serviceFile=LaunchAgents/org.nix-community.home.syncthing.plist
|
|
assertFileExists "$serviceFile"
|
|
assertFileContent "$serviceFile" ${./expected-agent.plist}
|
|
'';
|
|
})
|
|
]
|