2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2012-03-20 05:41:13 +01:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2012-03-20 05:41:13 +01:00
|
|
|
|
2016-12-18 20:50:49 +01:00
|
|
|
let cfg = config.services.hardware.pommed;
|
|
|
|
defaultConf = "${pkgs.pommed_light}/etc/pommed.conf.mactel";
|
|
|
|
in {
|
2012-03-20 05:41:13 +01:00
|
|
|
|
2014-09-18 16:12:36 +02:00
|
|
|
options = {
|
|
|
|
|
|
|
|
services.hardware.pommed = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
2016-12-18 20:50:49 +01:00
|
|
|
Whether to use the pommed tool to handle Apple laptop
|
|
|
|
keyboard hotkeys.
|
2014-09-18 16:12:36 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
configFile = mkOption {
|
2016-12-18 20:50:49 +01:00
|
|
|
type = types.nullOr types.path;
|
|
|
|
default = null;
|
2014-09-18 16:12:36 +02:00
|
|
|
description = ''
|
2016-12-18 20:50:49 +01:00
|
|
|
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.
|
2014-09-18 16:12:36 +02:00
|
|
|
'';
|
|
|
|
};
|
2012-03-20 05:41:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-12-18 20:50:49 +01:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ pkgs.polkit pkgs.pommed_light ];
|
2012-03-20 05:41:13 +01:00
|
|
|
|
2016-12-18 20:50:49 +01:00
|
|
|
environment.etc."pommed.conf".source =
|
|
|
|
if cfg.configFile == null then defaultConf else cfg.configFile;
|
2012-03-20 05:41:13 +01:00
|
|
|
|
2016-01-06 07:50:18 +01:00
|
|
|
systemd.services.pommed = {
|
2016-12-18 20:50:49 +01:00
|
|
|
description = "Pommed Apple Hotkeys Daemon";
|
2016-01-06 07:50:18 +01:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
2016-12-18 20:50:49 +01:00
|
|
|
script = "${pkgs.pommed_light}/bin/pommed -f";
|
2012-03-20 05:41:13 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|