2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-10-12 18:36:19 +02:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2008-06-03 09:06:35 +02:00
|
|
|
|
2008-11-23 02:28:45 +01:00
|
|
|
let
|
2009-10-12 18:36:19 +02:00
|
|
|
|
|
|
|
cfg = config.services.gpm;
|
|
|
|
|
|
|
|
in
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2008-11-23 02:28:45 +01:00
|
|
|
|
|
|
|
options = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
services.gpm = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
enable = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.bool;
|
2009-10-12 18:36:19 +02:00
|
|
|
default = false;
|
2022-07-28 23:19:15 +02:00
|
|
|
description = lib.mdDoc ''
|
2009-10-12 18:36:19 +02:00
|
|
|
Whether to enable GPM, the General Purpose Mouse daemon,
|
|
|
|
which enables mouse support in virtual consoles.
|
|
|
|
'';
|
2008-11-23 02:28:45 +01:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
protocol = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.str;
|
2009-10-12 18:36:19 +02:00
|
|
|
default = "ps/2";
|
2022-07-28 23:19:15 +02:00
|
|
|
description = lib.mdDoc "Mouse protocol to use.";
|
2009-10-12 18:36:19 +02:00
|
|
|
};
|
|
|
|
|
2008-11-23 02:28:45 +01:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2008-11-23 02:28:45 +01:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2008-11-23 02:28:45 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
###### implementation
|
2008-11-23 02:28:45 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
config = mkIf cfg.enable {
|
2008-06-03 09:06:35 +02:00
|
|
|
|
2014-04-18 18:45:20 +02:00
|
|
|
systemd.services.gpm =
|
|
|
|
{ description = "Console Mouse Daemon";
|
2008-11-23 02:28:45 +01:00
|
|
|
|
2014-04-18 18:45:20 +02:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
2014-04-28 19:12:48 +02:00
|
|
|
requires = [ "dev-input-mice.device" ];
|
2014-05-20 13:07:40 +02:00
|
|
|
after = [ "dev-input-mice.device" ];
|
2008-11-23 02:28:45 +01:00
|
|
|
|
2014-04-18 18:45:20 +02:00
|
|
|
serviceConfig.ExecStart = "@${pkgs.gpm}/sbin/gpm gpm -m /dev/input/mice -t ${cfg.protocol}";
|
|
|
|
serviceConfig.Type = "forking";
|
|
|
|
serviceConfig.PIDFile = "/run/gpm.pid";
|
2009-10-12 18:36:19 +02:00
|
|
|
};
|
2008-06-03 09:06:35 +02:00
|
|
|
|
2008-11-23 02:28:45 +01:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2008-06-03 09:06:35 +02:00
|
|
|
}
|