mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 15:14:26 +00:00
parent
cbc176010b
commit
86248a2d5c
3 changed files with 29 additions and 1 deletions
|
@ -9,6 +9,15 @@ with lib;
|
||||||
services.syncthing = {
|
services.syncthing = {
|
||||||
enable = mkEnableOption "Syncthing continuous file synchronization";
|
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 {
|
tray = mkOption {
|
||||||
type = with types;
|
type = with types;
|
||||||
either bool (submodule {
|
either bool (submodule {
|
||||||
|
@ -57,7 +66,9 @@ with lib;
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart =
|
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";
|
Restart = "on-failure";
|
||||||
SuccessExitStatus = [ 3 4 ];
|
SuccessExitStatus = [ 3 4 ];
|
||||||
RestartForceExitStatus = [ 3 4 ];
|
RestartForceExitStatus = [ 3 4 ];
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
syncthing-extra-options = ./extra-options.nix;
|
||||||
syncthing-tray = ./tray.nix;
|
syncthing-tray = ./tray.nix;
|
||||||
syncthing-tray-as-bool-triggers-warning = ./tray-as-bool-triggers-warning.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