2008-11-23 01:28:45 +00:00
|
|
|
{pkgs, config}:
|
2008-06-03 07:06:35 +00:00
|
|
|
|
2008-11-23 01:28:45 +00: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 01:29:25 +00:00
|
|
|
inherit (pkgs.lib) mkIf;
|
2008-11-23 01:28:45 +00:00
|
|
|
|
|
|
|
gpm = pkgs.gpm;
|
2008-06-03 07:06:35 +00:00
|
|
|
gpmBin = "${gpm}/sbin/gpm";
|
|
|
|
|
2008-11-23 01:28:45 +00: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 07:06:35 +00:00
|
|
|
in
|
|
|
|
|
2008-11-23 01:29:25 +00:00
|
|
|
mkIf cfg.enable {
|
2008-11-23 01:28:45 +00:00
|
|
|
require = [
|
|
|
|
(import ../upstart-jobs/default.nix) # config.services.extraJobs
|
|
|
|
# /etc/security/console.perms (should be generated ?)
|
|
|
|
options
|
|
|
|
];
|
2008-06-03 07:06:35 +00:00
|
|
|
|
2008-11-23 01:28:45 +00:00
|
|
|
services = {
|
2008-11-23 01:29:25 +00:00
|
|
|
extraJobs = [job];
|
2008-11-23 01:28:45 +00:00
|
|
|
};
|
2008-06-03 07:06:35 +00:00
|
|
|
}
|