1{ 2 lib, 3 stdenv, 4 fetchzip, 5 autoPatchelfHook, 6}: 7 8stdenv.mkDerivation rec { 9 pname = "discord-gamesdk"; 10 version = "3.2.1"; 11 12 src = fetchzip { 13 url = "https://dl-game-sdk.discordapp.net/${version}/discord_game_sdk.zip"; 14 hash = "sha256-83DgL9y3lHLLJ8vgL3EOVk2Tjcue64N+iuDj/UpSdLc="; 15 stripRoot = false; 16 }; 17 18 outputs = [ 19 "out" 20 "dev" 21 ]; 22 23 buildInputs = [ (stdenv.cc.cc.libgcc or null) ]; 24 25 nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook; 26 27 installPhase = 28 let 29 processor = stdenv.hostPlatform.parsed.cpu.name; 30 sharedLibrary = stdenv.hostPlatform.extensions.sharedLibrary; 31 in 32 '' 33 runHook preInstall 34 35 install -Dm555 lib/${processor}/discord_game_sdk${sharedLibrary} $out/lib/discord_game_sdk${sharedLibrary} 36 37 install -Dm444 c/discord_game_sdk.h $dev/lib/include/discord_game_sdk.h 38 39 runHook postInstall 40 ''; 41 42 meta = with lib; { 43 homepage = "https://discord.com/developers/docs/game-sdk/sdk-starter-guide"; 44 description = "Library to allow other programs to interact with the Discord desktop application"; 45 license = licenses.unfree; 46 maintainers = with maintainers; [ tomodachi94 ]; 47 sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 48 platforms = [ 49 "x86_64-linux" 50 "x86_64-darwin" 51 "aarch64-darwin" 52 "x86_64-windows" 53 ]; 54 }; 55}