From 2ba10cf17d94857dc9752053fcb1895d3b39aa52 Mon Sep 17 00:00:00 2001 From: Nikita Uvarov Date: Sun, 21 Jan 2018 21:24:48 +0100 Subject: [PATCH] syncthing: merge qsyncthingtray into the module --- modules/misc/news.nix | 10 ++++ modules/modules.nix | 1 - modules/services/qsyncthingtray.nix | 29 ------------ modules/services/syncthing.nix | 73 +++++++++++++++++++++-------- 4 files changed, 64 insertions(+), 49 deletions(-) delete mode 100644 modules/services/qsyncthingtray.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 31ebe552..a4b59833 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -539,6 +539,16 @@ in A new module is available: 'services.qsyncthingtray' ''; } + + { + time = "2018-01-25T11:35:08+00:00"; + message = '' + 'services.qsyncthingtray' has been merged into 'services.syncthing'. + Please, use 'services.syncthing.tray' option to activate the tray service. + + The old module will be removed on February 25, 2018. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 52935014..7fd76147 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -53,7 +53,6 @@ let ./services/owncloud-client.nix ./services/parcellite.nix ./services/polybar.nix - ./services/qsyncthingtray.nix ./services/random-background.nix ./services/redshift.nix ./services/screen-locker.nix diff --git a/modules/services/qsyncthingtray.nix b/modules/services/qsyncthingtray.nix deleted file mode 100644 index fb9dc287..00000000 --- a/modules/services/qsyncthingtray.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -{ - options = { - services.qsyncthingtray = { - enable = mkEnableOption "QSyncthingTray"; - }; - }; - - config = mkIf config.services.qsyncthingtray.enable { - systemd.user.services.qsyncthingtray = { - Unit = { - Description = "QSyncthingTray"; - After = [ "graphical-session-pre.target" ]; - PartOf = [ "graphical-session.target" ]; - }; - - Install = { - WantedBy = [ "graphical-session.target" ]; - }; - - Service = { - ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray"; - }; - }; - }; -} diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix index f722208d..5b34d9aa 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"; - }; - }; - 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" ]; - }; - - 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" ]; + tray = mkOption { + type = types.bool; + default = false; + description = "Whether to enable QSyncthingTray service."; }; }; }; + + 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 ]; + }; + + 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 = [ "graphical-session.target" ]; + }; + }; + }; + }) + ]); }