2009-10-12 17:36:19 +01:00
|
|
|
{ config, pkgs, ... }:
|
2009-03-30 15:58:05 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
with pkgs.lib;
|
2009-03-30 15:58:05 +01:00
|
|
|
|
|
|
|
let
|
2009-10-12 17:36:19 +01:00
|
|
|
|
|
|
|
cfgC = config.services.synergy.client;
|
|
|
|
cfgS = config.services.synergy.server;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
###### interface
|
2009-03-30 15:58:05 +01:00
|
|
|
|
|
|
|
options = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
services.synergy = {
|
|
|
|
|
|
|
|
# !!! All these option descriptions needs to be cleaned up.
|
|
|
|
|
|
|
|
client = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "
|
|
|
|
Whether to enable the synergy client (receive keyboard and mouse events from a synergy server)
|
|
|
|
";
|
|
|
|
};
|
|
|
|
screenName = mkOption {
|
|
|
|
default = "";
|
2011-09-14 19:20:50 +01:00
|
|
|
description = "
|
2009-10-12 17:36:19 +01:00
|
|
|
use screen-name instead the hostname to identify
|
|
|
|
ourselfs to the server.
|
2009-03-30 15:58:05 +01:00
|
|
|
";
|
|
|
|
};
|
2009-12-04 12:50:49 +00:00
|
|
|
serverAddress = mkOption {
|
2011-09-14 19:20:50 +01:00
|
|
|
description = "
|
2009-12-04 12:50:49 +00:00
|
|
|
The server address is of the form: [hostname][:port]. The
|
|
|
|
hostname must be the address or hostname of the server. The
|
|
|
|
port overrides the default port, 24800.
|
|
|
|
";
|
|
|
|
};
|
2009-10-12 17:36:19 +01:00
|
|
|
};
|
2009-03-30 15:58:05 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
server = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "
|
|
|
|
Whether to enable the synergy server (send keyboard and mouse events)
|
|
|
|
";
|
|
|
|
};
|
|
|
|
configFile = mkOption {
|
|
|
|
default = "/etc/synergy-server.conf";
|
|
|
|
description = "
|
|
|
|
The synergy server configuration file. open upstart-jobs/synergy.nix to see an example
|
|
|
|
";
|
|
|
|
};
|
|
|
|
screenName = mkOption {
|
|
|
|
default = "";
|
2011-09-14 19:20:50 +01:00
|
|
|
description = "
|
2009-10-12 17:36:19 +01:00
|
|
|
use screen-name instead the hostname to identify
|
|
|
|
this screen in the configuration.
|
2009-03-30 15:58:05 +01:00
|
|
|
";
|
2009-10-12 17:36:19 +01:00
|
|
|
};
|
|
|
|
address = mkOption {
|
|
|
|
default = "";
|
|
|
|
description = "listen for clients on the given address";
|
2009-03-30 15:58:05 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
###### implementation
|
2009-03-30 15:58:05 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
config = {
|
2009-03-30 15:58:05 +01:00
|
|
|
|
2009-10-12 19:09:34 +01:00
|
|
|
jobs =
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
optionalAttrs cfgC.enable
|
2011-09-14 19:20:50 +01:00
|
|
|
{ synergyClient =
|
2009-10-12 17:36:19 +01:00
|
|
|
{ name = "synergy-client";
|
2009-03-30 15:58:05 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
description = "Synergy client";
|
2009-03-30 15:58:05 +01:00
|
|
|
|
2009-11-06 22:19:17 +00:00
|
|
|
startOn = "started network-interfaces";
|
|
|
|
stopOn = "stopping network-interfaces";
|
2009-03-30 15:58:05 +01:00
|
|
|
|
2009-12-04 12:50:49 +00:00
|
|
|
exec = ''${pkgs.synergy}/bin/synergyc \
|
|
|
|
-f ${if cfgC.screenName == "" then "" else "-n ${cfgC.screenName}"} \
|
|
|
|
${cfgC.serverAddress}
|
|
|
|
'';
|
2009-10-12 17:36:19 +01:00
|
|
|
};
|
|
|
|
}
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
// optionalAttrs cfgS.enable
|
2011-09-14 19:20:50 +01:00
|
|
|
{ synergyServer =
|
2009-10-12 17:36:19 +01:00
|
|
|
{ name = "synergy-server";
|
|
|
|
|
|
|
|
description = "Synergy server";
|
|
|
|
|
2009-11-06 22:19:17 +00:00
|
|
|
startOn = "started network-interfaces";
|
|
|
|
stopOn = "stopping network-interfaces";
|
2009-10-12 17:36:19 +01:00
|
|
|
|
|
|
|
exec =
|
|
|
|
''
|
2009-10-12 18:09:38 +01:00
|
|
|
${pkgs.synergy}/bin/synergys -c ${cfgS.configFile} \
|
2009-10-12 17:36:19 +01:00
|
|
|
-f ${if cfgS.address == "" then "" else "-a ${cfgS.address}"} \
|
|
|
|
${if cfgS.screenName == "" then "" else "-n ${cfgS.screenName}" }
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2009-03-30 15:58:05 +01:00
|
|
|
|
|
|
|
};
|
2009-10-12 17:36:19 +01:00
|
|
|
|
2009-03-30 15:58:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* SYNERGY SERVER example configuration file
|
|
|
|
section: screens
|
|
|
|
laptop:
|
|
|
|
dm:
|
|
|
|
win:
|
|
|
|
end
|
|
|
|
section: aliases
|
2011-09-14 19:20:50 +01:00
|
|
|
laptop:
|
2009-03-30 15:58:05 +01:00
|
|
|
192.168.5.5
|
|
|
|
dm:
|
|
|
|
192.168.5.78
|
|
|
|
win:
|
|
|
|
192.168.5.54
|
|
|
|
end
|
|
|
|
section: links
|
|
|
|
laptop:
|
|
|
|
left = dm
|
|
|
|
dm:
|
|
|
|
right = laptop
|
|
|
|
left = win
|
|
|
|
win:
|
|
|
|
right = dm
|
|
|
|
end
|
|
|
|
*/
|