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