From 8297e09d78d30714f77230fcce22dfa0aaa5aa2a Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Thu, 4 Dec 2014 15:25:26 -0800 Subject: [PATCH] nixos/synergy: Don't generate units unecessarily --- nixos/modules/services/misc/synergy.nix | 41 ++++++++++++------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/nixos/modules/services/misc/synergy.nix b/nixos/modules/services/misc/synergy.nix index 5338b25715c..271968f48b8 100644 --- a/nixos/modules/services/misc/synergy.nix +++ b/nixos/modules/services/misc/synergy.nix @@ -81,27 +81,26 @@ in ###### implementation - config = { - - systemd.services."synergy-client" = { - enable = cfgC.enable; - after = [ "network.target" ]; - description = "Synergy client"; - wantedBy = optional cfgC.autoStart "multi-user.target"; - path = [ pkgs.synergy ]; - serviceConfig.ExecStart = ''${pkgs.synergy}/bin/synergyc -f ${optionalString (cfgC.screenName != "") "-n ${cfgC.screenName}"} ${cfgC.serverAddress}''; - }; - - systemd.services."synergy-server" = { - enable = cfgS.enable; - after = [ "network.target" ]; - description = "Synergy server"; - wantedBy = optional cfgS.autoStart "multi-user.target"; - path = [ pkgs.synergy ]; - serviceConfig.ExecStart = ''${pkgs.synergy}/bin/synergys -c ${cfgS.configFile} -f ${optionalString (cfgS.address != "") "-a ${cfgS.address}"} ${optionalString (cfgS.screenName != "") "-n ${cfgS.screenName}" }''; - }; - - }; + config = mkMerge [ + (mkIf cfgC.enable { + systemd.services."synergy-client" = { + after = [ "network.target" ]; + description = "Synergy client"; + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.synergy ]; + serviceConfig.ExecStart = ''${pkgs.synergy}/bin/synergyc -f ${optionalString (cfgC.screenName != "") "-n ${cfgC.screenName}"} ${cfgC.serverAddress}''; + }; + }) + (mkIf cfgS.enable { + systemd.services."synergy-server" = { + after = [ "network.target" ]; + description = "Synergy server"; + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.synergy ]; + serviceConfig.ExecStart = ''${pkgs.synergy}/bin/synergys -c ${cfgS.configFile} -f ${optionalString (cfgS.address != "") "-a ${cfgS.address}"} ${optionalString (cfgS.screenName != "") "-n ${cfgS.screenName}" }''; + }; + }) + ]; }