Convert "gpm" upstart-job to the fix-style.

svn path=/nixos/branches/fix-style/; revision=13376
This commit is contained in:
Nicolas Pierron 2008-11-23 01:28:45 +00:00
parent afe160c6b2
commit 585fd9d911
3 changed files with 52 additions and 32 deletions

View file

@ -2259,22 +2259,6 @@ in
};
gpm = {
enable = mkOption {
default = false;
description = "
Whether to enable general purpose mouse daemon.
";
};
protocol = mkOption {
default = "ps/2";
description = "
Mouse protocol to use.
";
};
};
postfix = {
enable = mkOption {
default = false;
@ -3035,6 +3019,7 @@ root ALL=(ALL) SETENV: ALL
(import ../upstart-jobs/pcmcia.nix)
# services
(import ../upstart-jobs/gpm.nix)
(import ../upstart-jobs/nagios/default.nix)
(import ../upstart-jobs/zabbix-agent.nix)
(import ../upstart-jobs/zabbix-server.nix)

View file

@ -406,12 +406,6 @@ let
inherit (pkgs) stdenv hal;
})
++ optional config.services.gpm.enable
(import ../upstart-jobs/gpm.nix {
inherit (pkgs) gpm;
gpmConfig = config.services.gpm;
})
# Postfix mail server.
++ optional config.services.postfix.enable
(import ../upstart-jobs/postfix.nix {

View file

@ -1,17 +1,58 @@
{gpm, gpmConfig}:
{pkgs, config}:
let
###### 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;
ifEnable = pkgs.lib.ifEnable cfg.enable;
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
{
name = "gpm";
job = ''
description = "General purpose mouse"
require = [
(import ../upstart-jobs/default.nix) # config.services.extraJobs
# /etc/security/console.perms (should be generated ?)
options
];
start on udev
stop on shutdown
respawn ${gpmBin} -m /dev/input/mice -t ${gpmConfig.protocol} -D &>/dev/null
'';
services = {
extraJobs = ifEnable [job];
};
}