mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 03:29:45 +01:00
parent
cbc176010b
commit
86248a2d5c
3 changed files with 29 additions and 1 deletions
|
@ -9,6 +9,15 @@ with lib;
|
|||
services.syncthing = {
|
||||
enable = mkEnableOption "Syncthing continuous file synchronization";
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "--gui-apikey=apiKey" ];
|
||||
description = ''
|
||||
Extra command-line arguments to pass to <command>syncthing</command>.
|
||||
'';
|
||||
};
|
||||
|
||||
tray = mkOption {
|
||||
type = with types;
|
||||
either bool (submodule {
|
||||
|
@ -57,7 +66,9 @@ with lib;
|
|||
|
||||
Service = {
|
||||
ExecStart =
|
||||
"${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0";
|
||||
"${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0"
|
||||
+ optionalString (config.services.syncthing.extraOptions != [ ])
|
||||
(" " + escapeShellArgs config.services.syncthing.extraOptions);
|
||||
Restart = "on-failure";
|
||||
SuccessExitStatus = [ 3 4 ];
|
||||
RestartForceExitStatus = [ 3 4 ];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
syncthing-extra-options = ./extra-options.nix;
|
||||
syncthing-tray = ./tray.nix;
|
||||
syncthing-tray-as-bool-triggers-warning = ./tray-as-bool-triggers-warning.nix;
|
||||
}
|
||||
|
|
16
tests/modules/services/syncthing/extra-options.nix
Normal file
16
tests/modules/services/syncthing/extra-options.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
extraOptions = [ "-foo" ''-bar "baz"'' ];
|
||||
};
|
||||
|
||||
test.stubs.syncthing = { };
|
||||
|
||||
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 -logflags=0 '-foo' '-bar \"baz\"'"
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue