From 0d67d95f32d7c39dd31f5823f589bc9c4bf3887f Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 20 Mar 2012 04:41:13 +0000 Subject: [PATCH] Add a module for the pommed tool for Apple laptop keyboards. svn path=/nixos/trunk/; revision=33286 --- modules/module-list.nix | 1 + modules/services/hardware/pommed.nix | 47 ++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 modules/services/hardware/pommed.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index 5eadfe0185ca..97c7b9fef1fa 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -75,6 +75,7 @@ ./services/hardware/hal.nix ./services/hardware/nvidia-optimus.nix ./services/hardware/pcscd.nix + ./services/hardware/pommed.nix ./services/hardware/sane.nix ./services/hardware/udev.nix ./services/hardware/udisks.nix diff --git a/modules/services/hardware/pommed.nix b/modules/services/hardware/pommed.nix new file mode 100644 index 000000000000..84f2925c4ae6 --- /dev/null +++ b/modules/services/hardware/pommed.nix @@ -0,0 +1,47 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +{ + + options.services.hardware.pommed = { + enable = mkOption { + default = false; + description = '' + Whether to use the pommed tool to handle Apple laptop keyboard hotkeys. + ''; + }; + + configFile = mkOption { + default = builtins.toPath "${pkgs.pommed}/etc/pommed.conf"; + description = '' + The contents of the pommed.conf file. + ''; + }; + }; + + config = mkIf config.services.hardware.pommed.enable { + environment.systemPackages = [ pkgs.polkit ]; + + environment.etc = [ + { source = config.services.hardware.pommed.configFile; + target = "pommed.conf"; + } + ]; + + services.dbus.packages = [ pkgs.pommed ]; + + jobs.pommed = { name = "pommed"; + + description = "Pommed hotkey management"; + + startOn = "started dbus"; + + postStop = "rm -f /var/run/pommed.pid"; + + exec = "${pkgs.pommed}/bin/pommed"; + + daemonType = "fork"; + }; + }; +}