summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/mp/mpd-mpris/package.nix
blob: edaabd5af9e74707a6c3058bc17ff2a09073e0f5 (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
{
  lib,
  buildGoModule,
  fetchFromGitHub,
  fetchpatch,
}:

buildGoModule (finalAttrs: {
  pname = "mpd-mpris";
  version = "0.4.3";

  src = fetchFromGitHub {
    owner = "natsukagami";
    repo = "mpd-mpris";
    tag = "v${finalAttrs.version}";
    hash = "sha256-w8OH34JW++OYLpNIHfQvc45dFyU/wVWVa+vEwWb8VqU=";
  };

  vendorHash = "sha256-ugJEw02jSsfObljDaup31zoQlf2HvwDRUljD7lp7Ys4=";

  subPackages = [ "cmd/mpd-mpris" ];

  patches = [
    (fetchpatch {
      url = "https://github.com/natsukagami/mpd-mpris/commit/1591f15548aed0f9741d723f24fb505cb24fafe8.patch";
      hash = "sha256-6ZqR4woKiIjwLxyafmidTM8eBXtvBzKNXZvtS1+KKKI=";
    })
  ];

  postPatch = ''
    substituteInPlace services/mpd-mpris.service --replace-fail "ExecStart=" "ExecStart=$out/bin/"
  '';

  postInstall = ''
    install -Dm644 services/mpd-mpris.service -t $out/lib/systemd/user
    install -Dm644 mpd-mpris.desktop -t $out/etc/xdg/autostart
  '';

  meta = {
    description = "Implementation of the MPRIS protocol for MPD";
    homepage = "https://github.com/natsukagami/mpd-mpris";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ doronbehar ];
    mainProgram = "mpd-mpris";
  };
})