1 { config, lib, pkgs, ... }:
7 cfgC = config.services.synergy.client;
8 cfgS = config.services.synergy.server;
19 # !!! All these option descriptions needs to be cleaned up.
22 enable = mkEnableOption (lib.mdDoc "the Synergy client (receive keyboard and mouse events from a Synergy server)");
24 screenName = mkOption {
27 description = lib.mdDoc ''
28 Use the given name instead of the hostname to identify
29 ourselves to the server.
32 serverAddress = mkOption {
34 description = lib.mdDoc ''
35 The server address is of the form: [hostname][:port]. The
36 hostname must be the address or hostname of the server. The
37 port overrides the default port, 24800.
40 autoStart = mkOption {
43 description = lib.mdDoc "Whether the Synergy client should be started automatically.";
48 enable = mkEnableOption (lib.mdDoc "the Synergy server (send keyboard and mouse events)");
50 configFile = mkOption {
52 default = "/etc/synergy-server.conf";
53 description = lib.mdDoc "The Synergy server configuration file.";
55 screenName = mkOption {
58 description = lib.mdDoc ''
59 Use the given name instead of the hostname to identify
60 this screen in the configuration.
66 description = lib.mdDoc "Address on which to listen for clients.";
68 autoStart = mkOption {
71 description = lib.mdDoc "Whether the Synergy server should be started automatically.";
77 description = lib.mdDoc ''
78 Whether TLS encryption should be used.
80 Using this requires a TLS certificate that can be
81 generated by starting the Synergy GUI once and entering
87 type = types.nullOr types.str;
89 example = "~/.synergy/SSL/Synergy.pem";
90 description = lib.mdDoc "The TLS certificate to use for encryption.";
103 systemd.user.services.synergy-client = {
104 after = [ "network.target" "graphical-session.target" ];
105 description = "Synergy client";
106 wantedBy = optional cfgC.autoStart "graphical-session.target";
107 path = [ pkgs.synergy ];
108 serviceConfig.ExecStart = ''${pkgs.synergy}/bin/synergyc -f ${optionalString (cfgC.screenName != "") "-n ${cfgC.screenName}"} ${cfgC.serverAddress}'';
109 serviceConfig.Restart = "on-failure";
113 systemd.user.services.synergy-server = {
114 after = [ "network.target" "graphical-session.target" ];
115 description = "Synergy server";
116 wantedBy = optional cfgS.autoStart "graphical-session.target";
117 path = [ pkgs.synergy ];
118 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}")}'';
119 serviceConfig.Restart = "on-failure";
126 /* SYNERGY SERVER example configuration file