2009-10-12 16:36:19 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2008-06-03 07:06:35 +00:00
|
|
|
|
2008-11-23 01:28:45 +00:00
|
|
|
let
|
2009-10-12 16:36:19 +00:00
|
|
|
|
|
|
|
cfg = config.services.gpm;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2008-11-23 01:28:45 +00:00
|
|
|
|
|
|
|
options = {
|
2009-10-12 16:36:19 +00:00
|
|
|
|
|
|
|
services.gpm = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to enable GPM, the General Purpose Mouse daemon,
|
|
|
|
which enables mouse support in virtual consoles.
|
|
|
|
'';
|
2008-11-23 01:28:45 +00:00
|
|
|
};
|
2009-10-12 16:36:19 +00:00
|
|
|
|
|
|
|
protocol = mkOption {
|
|
|
|
default = "ps/2";
|
|
|
|
description = "Mouse protocol to use.";
|
|
|
|
};
|
|
|
|
|
2008-11-23 01:28:45 +00:00
|
|
|
};
|
2009-10-12 16:36:19 +00:00
|
|
|
|
2008-11-23 01:28:45 +00:00
|
|
|
};
|
2009-10-12 16:36:19 +00:00
|
|
|
|
2008-11-23 01:28:45 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
###### implementation
|
2008-11-23 01:28:45 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
config = mkIf cfg.enable {
|
2008-06-03 07:06:35 +00:00
|
|
|
|
2009-10-12 18:09:34 +00:00
|
|
|
jobs.gpm =
|
2009-10-12 16:36:19 +00:00
|
|
|
{ description = "General purpose mouse";
|
2008-11-23 01:28:45 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
startOn = "udev";
|
|
|
|
stopOn = "shutdown";
|
2008-11-23 01:28:45 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
exec = "${pkgs.gpm}/sbin/gpm -m /dev/input/mice -t ${cfg.protocol} -D &>/dev/null";
|
|
|
|
};
|
2008-06-03 07:06:35 +00:00
|
|
|
|
2008-11-23 01:28:45 +00:00
|
|
|
};
|
2009-10-12 16:36:19 +00:00
|
|
|
|
2008-06-03 07:06:35 +00:00
|
|
|
}
|