diff --git a/system/options.nix b/system/options.nix index 2fb33c40c2f..3ce8eb62414 100644 --- a/system/options.nix +++ b/system/options.nix @@ -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) diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index 7604587fe1d..c63487c1b47 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -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 { diff --git a/upstart-jobs/gpm.nix b/upstart-jobs/gpm.nix index 798ad4041eb..ca55f1c8362 100644 --- a/upstart-jobs/gpm.nix +++ b/upstart-jobs/gpm.nix @@ -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]; + }; }