2008-12-04 16:48:27 +01:00
|
|
|
{pkgs, config, ...}:
|
2008-06-03 09:06:35 +02:00
|
|
|
|
2008-11-23 02:28:45 +01:00
|
|
|
###### interface
|
|
|
|
let
|
|
|
|
inherit (pkgs.lib) mkOption;
|
|
|
|
|
|
|
|
options = {
|
|
|
|
services = {
|
|
|
|
gpm = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "
|
|
|
|
Whether to enable general purpose mouse daemon.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
protocol = mkOption {
|
|
|
|
default = "ps/2";
|
|
|
|
description = "
|
|
|
|
Mouse protocol to use.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
let
|
|
|
|
cfg = config.services.gpm;
|
2008-11-23 02:29:25 +01:00
|
|
|
inherit (pkgs.lib) mkIf;
|
2008-11-23 02:28:45 +01:00
|
|
|
|
|
|
|
gpm = pkgs.gpm;
|
2008-06-03 09:06:35 +02:00
|
|
|
gpmBin = "${gpm}/sbin/gpm";
|
|
|
|
|
2008-11-23 02:28:45 +01:00
|
|
|
job = {
|
|
|
|
name = "gpm";
|
|
|
|
job = ''
|
|
|
|
description = "General purpose mouse"
|
|
|
|
|
|
|
|
start on udev
|
|
|
|
stop on shutdown
|
|
|
|
|
|
|
|
respawn ${gpmBin} -m /dev/input/mice -t ${cfg.protocol} -D &>/dev/null
|
|
|
|
'';
|
|
|
|
};
|
2008-06-03 09:06:35 +02:00
|
|
|
in
|
|
|
|
|
2008-11-23 02:29:25 +01:00
|
|
|
mkIf cfg.enable {
|
2008-11-23 02:28:45 +01:00
|
|
|
require = [
|
2009-05-25 01:13:23 +02:00
|
|
|
# ../upstart-jobs/default.nix # config.services.extraJobs
|
2008-11-23 02:28:45 +01:00
|
|
|
# /etc/security/console.perms (should be generated ?)
|
|
|
|
options
|
|
|
|
];
|
2008-06-03 09:06:35 +02:00
|
|
|
|
2008-11-23 02:28:45 +01:00
|
|
|
services = {
|
2008-11-23 02:29:25 +01:00
|
|
|
extraJobs = [job];
|
2008-11-23 02:28:45 +01:00
|
|
|
};
|
2008-06-03 09:06:35 +02:00
|
|
|
}
|