2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let cfg = config.services.hardware.pommed;
|
|
|
|
defaultConf = "${pkgs.pommed_light}/etc/pommed.conf.mactel";
|
|
|
|
in {
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.hardware.pommed = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-04-24 23:36:52 +00:00
|
|
|
Whether to use the pommed tool to handle Apple laptop
|
|
|
|
keyboard hotkeys.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
configFile = mkOption {
|
|
|
|
type = types.nullOr types.path;
|
|
|
|
default = null;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
The path to the {file}`pommed.conf` file. Leave
|
2020-04-24 23:36:52 +00:00
|
|
|
to null to use the default config file
|
2022-08-12 12:06:08 +00:00
|
|
|
({file}`/etc/pommed.conf.mactel`). See the
|
|
|
|
files {file}`/etc/pommed.conf.mactel` and
|
|
|
|
{file}`/etc/pommed.conf.pmac` for examples to
|
2020-04-24 23:36:52 +00:00
|
|
|
build on.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ pkgs.polkit pkgs.pommed_light ];
|
|
|
|
|
|
|
|
environment.etc."pommed.conf".source =
|
|
|
|
if cfg.configFile == null then defaultConf else cfg.configFile;
|
|
|
|
|
|
|
|
systemd.services.pommed = {
|
|
|
|
description = "Pommed Apple Hotkeys Daemon";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
script = "${pkgs.pommed_light}/bin/pommed -f";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|