at 23.11-pre 1.3 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let cfg = config.services.hardware.pommed; 6 defaultConf = "${pkgs.pommed_light}/etc/pommed.conf.mactel"; 7in { 8 9 options = { 10 11 services.hardware.pommed = { 12 13 enable = mkOption { 14 type = types.bool; 15 default = false; 16 description = lib.mdDoc '' 17 Whether to use the pommed tool to handle Apple laptop 18 keyboard hotkeys. 19 ''; 20 }; 21 22 configFile = mkOption { 23 type = types.nullOr types.path; 24 default = null; 25 description = lib.mdDoc '' 26 The path to the {file}`pommed.conf` file. Leave 27 to null to use the default config file 28 ({file}`/etc/pommed.conf.mactel`). See the 29 files {file}`/etc/pommed.conf.mactel` and 30 {file}`/etc/pommed.conf.pmac` for examples to 31 build on. 32 ''; 33 }; 34 }; 35 36 }; 37 38 config = mkIf cfg.enable { 39 environment.systemPackages = [ pkgs.polkit pkgs.pommed_light ]; 40 41 environment.etc."pommed.conf".source = 42 if cfg.configFile == null then defaultConf else cfg.configFile; 43 44 systemd.services.pommed = { 45 description = "Pommed Apple Hotkeys Daemon"; 46 wantedBy = [ "multi-user.target" ]; 47 script = "${pkgs.pommed_light}/bin/pommed -f"; 48 }; 49 }; 50}