1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

syncthingtray: add extraOptions

The test currently fails, because the nix path in the generated unit
does not get rewritten to `@syncthingtray@`. Pointers would be
appreciated.
This commit is contained in:
Motiejus Jakštys 2023-10-09 09:31:44 +03:00
parent 6bba64781e
commit 76fe6d9465
2 changed files with 19 additions and 2 deletions

View file

@ -49,6 +49,15 @@ in {
description = "Syncthing tray command to use."; 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 { package = mkOption {
type = types.package; type = types.package;
default = pkgs.syncthingtray-minimal; default = pkgs.syncthingtray-minimal;
@ -126,7 +135,9 @@ in {
}; };
Service = { 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" ]; }; Install = { WantedBy = [ "graphical-session.target" ]; };

View file

@ -4,7 +4,12 @@ with lib;
{ {
config = { config = {
services.syncthing.tray.enable = true; services.syncthing.tray = {
enable = true;
extraOptions = [ "--wait" ];
};
test.stubs.syncthingtray = { };
nixpkgs.overlays = [ nixpkgs.overlays = [
(self: super: { (self: super: {
@ -16,6 +21,7 @@ with lib;
nmt.script = '' nmt.script = ''
assertFileExists home-files/.config/systemd/user/syncthingtray.service assertFileExists home-files/.config/systemd/user/syncthingtray.service
assertFileContains home-files/.config/systemd/user/syncthingtray.service "ExecStart='@syncthingtray@/bin/syncthingtray' '--wait'"
''; '';
}; };
} }