summary refs log tree commit diff
path: root/nixos/modules/services/misc/synergy.nix
diff options
context:
space:
mode:
authorJoshua Trees <me@jtrees.io>2021-05-31 00:15:56 +0200
committerJoshua Trees <me@jtrees.io>2021-06-11 14:52:34 +0200
commit706ce9e2308ac370088abb09cf63b20cce2b07cf (patch)
treeff0f6447442f855bf9397cdf4fb21d38da95a746 /nixos/modules/services/misc/synergy.nix
parent890a3e8558bdd5dbdd964191a79d2141a05bde30 (diff)
downloadnixpkgs-706ce9e2308ac370088abb09cf63b20cce2b07cf.tar
nixpkgs-706ce9e2308ac370088abb09cf63b20cce2b07cf.tar.gz
nixpkgs-706ce9e2308ac370088abb09cf63b20cce2b07cf.tar.bz2
nixpkgs-706ce9e2308ac370088abb09cf63b20cce2b07cf.tar.lz
nixpkgs-706ce9e2308ac370088abb09cf63b20cce2b07cf.tar.xz
nixpkgs-706ce9e2308ac370088abb09cf63b20cce2b07cf.tar.zst
nixpkgs-706ce9e2308ac370088abb09cf63b20cce2b07cf.zip
nixos/synergy: add encryption support
Make it possible to use the Synergy server with TLS encryption without
resorting to the GUI.
Diffstat (limited to 'nixos/modules/services/misc/synergy.nix')
-rw-r--r--nixos/modules/services/misc/synergy.nix22
1 files changed, 21 insertions, 1 deletions
diff --git a/nixos/modules/services/misc/synergy.nix b/nixos/modules/services/misc/synergy.nix
index 7990a9f6f4c..d6cd5d7f0d6 100644
--- a/nixos/modules/services/misc/synergy.nix
+++ b/nixos/modules/services/misc/synergy.nix
@@ -70,6 +70,26 @@ in
           type = types.bool;
           description = "Whether the Synergy server should be started automatically.";
         };
+        tls = {
+          enable = mkOption {
+            type = types.bool;
+            default = false;
+            description = ''
+              Whether TLS encryption should be used.
+
+              Using this requires a TLS certificate that can be
+              generated by starting the Synergy GUI once and entering
+              a valid product key.
+            '';
+          };
+
+          cert = mkOption {
+            type = types.nullOr types.str;
+            default = null;
+            example = "~/.synergy/SSL/Synergy.pem";
+            description = "The TLS certificate to use for encryption.";
+          };
+        };
       };
     };
 
@@ -95,7 +115,7 @@ in
         description = "Synergy server";
         wantedBy = optional cfgS.autoStart "graphical-session.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}" }'';
+        serviceConfig.ExecStart = ''${pkgs.synergy}/bin/synergys -c ${cfgS.configFile} -f${optionalString (cfgS.address != "") " -a ${cfgS.address}"}${optionalString (cfgS.screenName != "") " -n ${cfgS.screenName}"}${optionalString cfgS.tls.enable " --enable-crypto"}${optionalString (cfgS.tls.cert != null) (" --tls-cert=${cfgS.tls.cert}")}'';
         serviceConfig.Restart = "on-failure";
       };
     })