1{
2 fetchFromGitHub,
3 buildGoModule,
4 buildLua,
5 lib,
6}:
7let
8 version = "1.6.1";
9
10 src = fetchFromGitHub {
11 owner = "tnychn";
12 repo = "mpv-discord";
13 rev = "v${version}";
14 hash = "sha256-P1UaXGboOiqrXapfLzJI6IT3esNtflkQkcNXt4Umukc=";
15 };
16
17 core = buildGoModule {
18 name = "mpv-discord-core";
19 inherit version;
20
21 src = "${src}/mpv-discord";
22
23 vendorHash = "sha256-xe1jyWFQUD+Z4qBAVQ0SBY0gdxmi5XG9t29n3f/WKDs=";
24 };
25in
26buildLua {
27 pname = "mpv-discord";
28 inherit version src;
29
30 scriptPath = "scripts/discord.lua";
31
32 postInstall = ''
33 substituteInPlace $out/share/mpv/scripts/discord.lua \
34 --replace-fail 'binary_path = ""' 'binary_path = "${core}/bin/mpv-discord"'
35 '';
36
37 meta = {
38 description = "Cross-platform Discord Rich Presence integration for mpv with no external dependencies";
39 homepage = "https://github.com/tnychn/mpv-discord";
40 license = lib.licenses.mit;
41 platforms = lib.platforms.all;
42 maintainers = with lib.maintainers; [ bddvlpr ];
43 };
44}