summary refs log tree commit diff
diff options
context:
space:
mode:
authorBalletie <skip_meesie@hotmail.com>2016-12-18 20:50:49 +0100
committerJoachim Fasting <joachifm@fastmail.fm>2017-01-02 19:40:50 +0100
commite5f5aa52e5bb4415c3111aa34de0654fa8999ea2 (patch)
tree1ba771bd54b288c4e44632d4a84a59e928493dcd
parent66c745e30d26ee30de4a6fa4dfc7862b48ee2697 (diff)
downloadnixpkgs-e5f5aa52e5bb4415c3111aa34de0654fa8999ea2.tar
nixpkgs-e5f5aa52e5bb4415c3111aa34de0654fa8999ea2.tar.gz
nixpkgs-e5f5aa52e5bb4415c3111aa34de0654fa8999ea2.tar.bz2
nixpkgs-e5f5aa52e5bb4415c3111aa34de0654fa8999ea2.tar.lz
nixpkgs-e5f5aa52e5bb4415c3111aa34de0654fa8999ea2.tar.xz
nixpkgs-e5f5aa52e5bb4415c3111aa34de0654fa8999ea2.tar.zst
nixpkgs-e5f5aa52e5bb4415c3111aa34de0654fa8999ea2.zip
pommed service: use pommed-light
The pommed package was marked as broken. It is also severely
unmaintained. I therefore chose to replace it entirely with
`pommed-light`, for now.
-rw-r--r--nixos/modules/services/hardware/pommed.nix36
1 files changed, 19 insertions, 17 deletions
diff --git a/nixos/modules/services/hardware/pommed.nix b/nixos/modules/services/hardware/pommed.nix
index 7be4dc1e846..bf7d6a46a29 100644
--- a/nixos/modules/services/hardware/pommed.nix
+++ b/nixos/modules/services/hardware/pommed.nix
@@ -2,7 +2,9 @@
 
 with lib;
 
-{
+let cfg = config.services.hardware.pommed;
+    defaultConf = "${pkgs.pommed_light}/etc/pommed.conf.mactel";
+in {
 
   options = {
 
@@ -12,37 +14,37 @@ with lib;
         type = types.bool;
         default = false;
         description = ''
-          Whether to use the pommed tool to handle Apple laptop keyboard hotkeys.
+          Whether to use the pommed tool to handle Apple laptop
+          keyboard hotkeys.
         '';
       };
 
       configFile = mkOption {
-        type = types.path;
+        type = types.nullOr types.path;
+        default = null;
         description = ''
-          The path to the <filename>pommed.conf</filename> file.
+          The path to the <filename>pommed.conf</filename> file. Leave
+          to null to use the default config file
+          (<filename>/etc/pommed.conf.mactel</filename>). See the
+          files <filename>/etc/pommed.conf.mactel</filename> and
+          <filename>/etc/pommed.conf.pmac</filename> for examples to
+          build on.
         '';
       };
     };
 
   };
 
-  config = mkIf config.services.hardware.pommed.enable {
-    environment.systemPackages = [ pkgs.polkit ];
+  config = mkIf cfg.enable {
+    environment.systemPackages = [ pkgs.polkit pkgs.pommed_light ];
 
-    environment.etc."pommed.conf".source = config.services.hardware.pommed.configFile;
-
-    services.hardware.pommed.configFile = "${pkgs.pommed}/etc/pommed.conf";
-
-    services.dbus.packages = [ pkgs.pommed ];
+    environment.etc."pommed.conf".source =
+      if cfg.configFile == null then defaultConf else cfg.configFile;
 
     systemd.services.pommed = {
-      description = "Pommed hotkey management";
+      description = "Pommed Apple Hotkeys Daemon";
       wantedBy = [ "multi-user.target" ];
-      after = [ "dbus.service" ];
-      postStop = "rm -f /var/run/pommed.pid";
-      script = "${pkgs.pommed}/bin/pommed";
-      serviceConfig.Type = "forking";
-      path = [ pkgs.eject ];
+      script = "${pkgs.pommed_light}/bin/pommed -f";
     };
   };
 }