about summary refs log tree commit diff
path: root/pkgs/by-name/di/discord-gamesdk/package.nix
blob: b2f9a08dc772465f4497fa26683b74680b88a6aa (plain) (blame)
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
47
48
49
50
51
52
53
54
55
{
  lib,
  stdenv,
  fetchzip,
  autoPatchelfHook,
}:

stdenv.mkDerivation rec {
  pname = "discord-gamesdk";
  version = "3.2.1";

  src = fetchzip {
    url = "https://dl-game-sdk.discordapp.net/${version}/discord_game_sdk.zip";
    sha256 = "sha256-83DgL9y3lHLLJ8vgL3EOVk2Tjcue64N+iuDj/UpSdLc=";
    stripRoot = false;
  };

  outputs = [
    "out"
    "dev"
  ];

  buildInputs = [ (stdenv.cc.cc.libgcc or null) ];

  nativeBuildInputs = [ autoPatchelfHook ];

  installPhase =
    let
      processor = stdenv.hostPlatform.uname.processor;
      sharedLibrary = stdenv.hostPlatform.extensions.sharedLibrary;
    in
    ''
      runHook preInstall

      install -Dm555 lib/${processor}/discord_game_sdk${sharedLibrary} $out/lib/discord_game_sdk${sharedLibrary}

      install -Dm444 c/discord_game_sdk.h $dev/lib/include/discord_game_sdk.h

      runHook postInstall
    '';

  meta = with lib; {
    homepage = "https://discord.com/developers/docs/game-sdk/sdk-starter-guide";
    description = "Library to allow other programs to interact with the Discord desktop application";
    license = licenses.unfree;
    maintainers = with maintainers; [ tomodachi94 ];
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
    platforms = [
      "x86_64-linux"
      "x86_64-darwin"
      "aarch64-darwin"
      "x86_64-windows"
    ];
  };
}