1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 cfg = config.services.gpm;
8
9in
10
11{
12
13 ###### interface
14
15 options = {
16
17 services.gpm = {
18
19 enable = mkOption {
20 type = types.bool;
21 default = false;
22 description = ''
23 Whether to enable GPM, the General Purpose Mouse daemon,
24 which enables mouse support in virtual consoles.
25 '';
26 };
27
28 protocol = mkOption {
29 type = types.str;
30 default = "ps/2";
31 description = "Mouse protocol to use.";
32 };
33
34 };
35
36 };
37
38
39 ###### implementation
40
41 config = mkIf cfg.enable {
42
43 systemd.services.gpm =
44 { description = "Console Mouse Daemon";
45
46 wantedBy = [ "multi-user.target" ];
47 requires = [ "dev-input-mice.device" ];
48 after = [ "dev-input-mice.device" ];
49
50 serviceConfig.ExecStart = "@${pkgs.gpm}/sbin/gpm gpm -m /dev/input/mice -t ${cfg.protocol}";
51 serviceConfig.Type = "forking";
52 serviceConfig.PIDFile = "/run/gpm.pid";
53 };
54
55 };
56
57}