summary refs log tree commit diff
path: root/pkgs/games/steam/runtime-wrapped.nix
blob: 8e4f5b866bbccc7b87805bfdadca3dc111accf57 (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
{ stdenv, steamArch, lib, perl, pkgs, steam-runtime
, runtimeOnly ? false
}:

let
  overridePkgs = lib.optionals (!runtimeOnly) (with pkgs; [
    libgpgerror
    libpulseaudio
    alsaLib
    openalSoft
    libva1
    libvdpau
    vulkan-loader
    gcc.cc.lib
    nss
    nspr
    xorg.libxcb
  ]);

  allPkgs = overridePkgs ++ [ steam-runtime ];

  gnuArch = if steamArch == "amd64" then "x86_64-linux-gnu"
            else if steamArch == "i386" then "i386-linux-gnu"
            else abort "Unsupported architecture";

  libs = [ "lib/${gnuArch}" "lib" "usr/lib/${gnuArch}" "usr/lib" ];
  bins = [ "bin" "usr/bin" ];

in stdenv.mkDerivation {
  name = "steam-runtime-wrapped";

  nativeBuildInputs = [ perl ];

  builder = ./build-wrapped.sh;

  passthru = {
    inherit gnuArch libs bins overridePkgs;
    arch = steamArch;
  };

  installPhase = ''
    buildDir "${toString libs}" "${toString (map lib.getLib allPkgs)}"
    buildDir "${toString bins}" "${toString (map lib.getBin allPkgs)}"
  '';
}