From e5f5aa52e5bb4415c3111aa34de0654fa8999ea2 Mon Sep 17 00:00:00 2001 From: Balletie Date: Sun, 18 Dec 2016 20:50:49 +0100 Subject: [PATCH] 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. --- nixos/modules/services/hardware/pommed.nix | 36 ++++++++++++---------- 1 file 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 pommed.conf file. + The path to the pommed.conf file. Leave + to null to use the default config file + (/etc/pommed.conf.mactel). See the + files /etc/pommed.conf.mactel and + /etc/pommed.conf.pmac 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"; }; }; }