1{ 2 lib, 3 fetchzip, 4 stdenv, 5 buildPythonPackage, 6 fetchFromGitHub, 7 8 setuptools, 9}: 10let 11 rev = "26780de81b8c14d48fe8d757c642086f2af2a66b"; 12 13 src = fetchFromGitHub { 14 owner = "philippj"; 15 repo = "SteamworksPy"; 16 inherit rev; 17 hash = "sha256-nSGkEP6tny/Kv2+YjldFCYrLe1jnKOTa+w1/KCpSLsU="; 18 19 }; 20 steamworksSrc = fetchzip { 21 url = "https://web.archive.org/web/20250527013243/https://partner.steamgames.com/downloads/steamworks_sdk_162.zip"; 22 hash = "sha256-yDA92nGj3AKTNI4vnoLaa+7mDqupQv0E4YKRRUWqyZw="; 23 }; 24 25 library = stdenv.mkDerivation { 26 pname = "steamworkspy-c"; 27 version = rev; 28 29 unpackPhase = '' 30 runHook preUnpack 31 32 cp -r ${src} source 33 chmod -R 755 source 34 cp -r ${steamworksSrc}/public/steam source/library/sdk/ 35 cp ${steamworksSrc}/redistributable_bin/linux64/libsteam_api.so source/library/ 36 37 runHook postUnpack 38 ''; 39 40 sourceRoot = "source/library"; 41 42 installPhase = '' 43 mkdir -p $out 44 cp SteamworksPy.so $out/ 45 ''; 46 }; 47in 48 49buildPythonPackage { 50 pname = "steamworkspy"; 51 version = rev; 52 pyproject = true; 53 54 inherit src; 55 56 build-system = [ setuptools ]; 57 58 postInstall = '' 59 cp ${library}/SteamworksPy.so $out/lib 60 ''; 61 62 meta = { 63 description = "Python API system for Valve's Steamworks"; 64 homepage = "https://github.com/philippj/SteamworksPy"; 65 license = with lib.licenses; [ 66 mit 67 # For steamworks headers and libsteamapi.so 68 ( 69 unfreeRedistributable 70 // { 71 url = "https://partner.steamgames.com/documentation/sdk_access_agreement"; 72 } 73 ) 74 ]; 75 # steamworksSrc is x86_64-linux only 76 platforms = [ "x86_64-linux" ]; 77 maintainers = with lib.maintainers; [ weirdrock ]; 78 }; 79}