summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/steamworkspy/default.nix
blob: 34b7c386bb8447b6d554606778f8f0a5d44da994 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
  lib,
  fetchzip,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,

  setuptools,
}:
let
  rev = "26780de81b8c14d48fe8d757c642086f2af2a66b";

  src = fetchFromGitHub {
    owner = "philippj";
    repo = "SteamworksPy";
    inherit rev;
    hash = "sha256-nSGkEP6tny/Kv2+YjldFCYrLe1jnKOTa+w1/KCpSLsU=";

  };
  steamworksSrc = fetchzip {
    url = "https://web.archive.org/web/20250527013243/https://partner.steamgames.com/downloads/steamworks_sdk_162.zip";
    hash = "sha256-yDA92nGj3AKTNI4vnoLaa+7mDqupQv0E4YKRRUWqyZw=";
  };

  library = stdenv.mkDerivation {
    pname = "steamworkspy-c";
    version = rev;

    unpackPhase = ''
      runHook preUnpack

      cp -r ${src} source
      chmod -R 755 source
      cp -r ${steamworksSrc}/public/steam source/library/sdk/
      cp ${steamworksSrc}/redistributable_bin/linux64/libsteam_api.so source/library/

      runHook postUnpack
    '';

    sourceRoot = "source/library";

    installPhase = ''
      mkdir -p $out
      cp SteamworksPy.so $out/
    '';
  };
in

buildPythonPackage {
  pname = "steamworkspy";
  version = rev;
  pyproject = true;

  inherit src;

  build-system = [ setuptools ];

  postInstall = ''
    cp ${library}/SteamworksPy.so $out/lib
  '';

  meta = {
    description = "Python API system for Valve's Steamworks";
    homepage = "https://github.com/philippj/SteamworksPy";
    license = with lib.licenses; [
      mit
      # For steamworks headers and libsteamapi.so
      (
        unfreeRedistributable
        // {
          url = "https://partner.steamgames.com/documentation/sdk_access_agreement";
        }
      )
    ];
    # steamworksSrc is x86_64-linux only
    platforms = [ "x86_64-linux" ];
    maintainers = with lib.maintainers; [ weirdrock ];
  };
}