mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 07:05:13 +00:00
2f0e8e370a
svn path=/nixos/branches/fix-style/; revision=13584
59 lines
1.0 KiB
Nix
59 lines
1.0 KiB
Nix
{pkgs, config, ...}:
|
|
|
|
###### 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;
|
|
inherit (pkgs.lib) mkIf;
|
|
|
|
gpm = pkgs.gpm;
|
|
gpmBin = "${gpm}/sbin/gpm";
|
|
|
|
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
|
|
'';
|
|
};
|
|
in
|
|
|
|
mkIf cfg.enable {
|
|
require = [
|
|
(import ../upstart-jobs/default.nix) # config.services.extraJobs
|
|
# /etc/security/console.perms (should be generated ?)
|
|
options
|
|
];
|
|
|
|
services = {
|
|
extraJobs = [job];
|
|
};
|
|
}
|