aboutsummaryrefslogtreecommitdiff
path: root/modules/services/syncthing.nix
diff options
context:
space:
mode:
authorNikita Uvarov <uv.nikita@gmail.com>2018-01-21 21:24:48 +0100
committerRobert Helgesson <robert@rycee.net>2018-01-25 21:52:01 +0100
commita597c66afe50dc54c4ea426497fe99e3c1d45ee5 (patch)
tree980f5440882f86ed54f3da709a31011a3e77c223 /modules/services/syncthing.nix
parent21fefbc8f6f1c0c496414df8ad9c4e578ed4d8e4 (diff)
syncthing: merge qsyncthingtray into the module
Diffstat (limited to 'modules/services/syncthing.nix')
-rw-r--r--modules/services/syncthing.nix67
1 files changed, 51 insertions, 16 deletions
diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix
index f722208d1a3..5b34d9aa5e1 100644
--- a/modules/services/syncthing.nix
+++ b/modules/services/syncthing.nix
@@ -3,32 +3,67 @@
with lib;
{
+ imports = [
+ (mkRenamedOptionModule
+ [ "services" "qsyncthingtray" "enable" ]
+ [ "services" "syncthing" "tray" ])
+ ];
+
meta.maintainers = [ maintainers.rycee ];
options = {
services.syncthing = {
enable = mkEnableOption "Syncthing continuous file synchronization";
+
+ tray = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable QSyncthingTray service.";
+ };
};
};
- config = mkIf config.services.syncthing.enable {
- systemd.user.services.syncthing = {
- Unit = {
- Description = "Syncthing - Open Source Continuous File Synchronization";
- Documentation = "man:syncthing(1)";
- After = [ "network.target" ];
- };
+ config = mkIf config.services.syncthing.enable (mkMerge [
+ {
+ systemd.user.services = {
+ syncthing = {
+ Unit = {
+ Description = "Syncthing - Open Source Continuous File Synchronization";
+ Documentation = "man:syncthing(1)";
+ After = [ "network.target" ];
+ };
- Service = {
- ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0";
- Restart = "on-failure";
- SuccessExitStatus = [ 3 4 ];
- RestartForceExitStatus = [ 3 4 ];
+ Service = {
+ ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0";
+ Restart = "on-failure";
+ SuccessExitStatus = [ 3 4 ];
+ RestartForceExitStatus = [ 3 4 ];
+ };
+
+ Install = {
+ WantedBy = [ "default.target" ];
+ };
+ };
};
+ }
+ (mkIf config.services.syncthing.tray {
+ systemd.user.services = {
+ qsyncthingtray = {
+ Unit = {
+ Description = "QSyncthingTray";
+ After = [ "graphical-session-pre.target" ];
+ PartOf = [ "graphical-session.target" ];
+ };
+
+ Service = {
+ ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray";
+ };
- Install = {
- WantedBy = [ "default.target" ];
+ Install = {
+ WantedBy = [ "graphical-session.target" ];
+ };
+ };
};
- };
- };
+ })
+ ]);
}