zaphyra's git: airpodsctl

Control and monitor your AirPods

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
{ config, lib, pkgs, ... }:

let
  cfg = config.services.kairpodsd;

in {

  options.services.kairpodsd = {
    enable = lib.mkEnableOption {
      type = lib.types.bool;
      default = false;
    };
  };

  config = lib.mkIf cfg.enable {
    systemd.user.services.kairpodsd = {
      Unit = {
        Description = "kAirPods D-Bus Service";
        After = [ "graphical-session.target" ];
      };
      Service = {
        Type = "dbus";
        BusName = "org.kairpods";
        ExecStart = lib.getExe pkgs.kairpodsd;
        Restart = "on-failure";
        RestartSec = 5;
        PrivateTmp = true;
        NoNewPrivileges = true;
      };
      Install.WantedBy = [ "default.target" ];
    };
  };

}