2009-10-12 17:36:19 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2008-06-03 08:06:35 +01:00
|
|
|
|
2008-11-23 01:28:45 +00:00
|
|
|
let
|
2009-10-12 17:36:19 +01:00
|
|
|
|
|
|
|
cfg = config.services.gpm;
|
|
|
|
|
|
|
|
in
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2008-11-23 01:28:45 +00:00
|
|
|
|
|
|
|
options = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
services.gpm = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
enable = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
type = types.bool;
|
2009-10-12 17:36:19 +01:00
|
|
|
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
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
protocol = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
type = types.str;
|
2009-10-12 17:36:19 +01:00
|
|
|
default = "ps/2";
|
|
|
|
description = "Mouse protocol to use.";
|
|
|
|
};
|
|
|
|
|
2008-11-23 01:28:45 +00:00
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2008-11-23 01:28:45 +00:00
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2008-11-23 01:28:45 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
###### implementation
|
2008-11-23 01:28:45 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
config = mkIf cfg.enable {
|
2008-06-03 08:06:35 +01:00
|
|
|
|
2009-10-12 19:09:34 +01:00
|
|
|
jobs.gpm =
|
2009-10-12 17:36:19 +01:00
|
|
|
{ description = "General purpose mouse";
|
2008-11-23 01:28:45 +00:00
|
|
|
|
2009-11-06 22:19:17 +00:00
|
|
|
startOn = "started udev";
|
2008-11-23 01:28:45 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
exec = "${pkgs.gpm}/sbin/gpm -m /dev/input/mice -t ${cfg.protocol} -D &>/dev/null";
|
|
|
|
};
|
2008-06-03 08:06:35 +01:00
|
|
|
|
2008-11-23 01:28:45 +00:00
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2008-06-03 08:06:35 +01:00
|
|
|
}
|