fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMove platform check into modules5f433eb1

master
865 B37 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7  cfg = config.services.mpris-proxy;
8
9in {
10  meta.maintainers = [ maintainers.thibautmarty ];
11
12  options.services.mpris-proxy.enable = mkEnableOption
13    "a proxy forwarding Bluetooth MIDI controls via MPRIS2 to control media players";
14
15  config = mkIf cfg.enable {
16    assertions = [
17      (lib.hm.assertions.assertPlatform "services.mpris-proxy" pkgs
18        lib.platforms.linux)
19    ];
20
21    systemd.user.services.mpris-proxy = {
22      Unit = {
23        Description =
24          "Proxy forwarding Bluetooth MIDI controls via MPRIS2 to control media players";
25        BindsTo = [ "bluetooth.target" ];
26        After = [ "bluetooth.target" ];
27      };
28
29      Install.WantedBy = [ "bluetooth.target" ];
30
31      Service = {
32        Type = "simple";
33        ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
34      };
35    };
36  };
37}