summary refs log tree commit diff
path: root/pkgs/games/steam/default.nix
blob: 3dbeed83885b9a8543385ec6fd73a47a6f532bd5 (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
{ stdenv, fetchurl, dpkg, makeWrapper, xz }:

assert stdenv.system == "i686-linux";

let version = "1.0.0.16"; in

stdenv.mkDerivation rec {
  name = "steam-${version}";

  src = fetchurl {
    url = "http://media.steampowered.com/client/installer/steam.deb";
    sha256 = "0mx92f9hjjpg3blgmgp8sz0f3jg7m9hssdscipwybks258k8926m";
  };

  buildInputs = [ dpkg makeWrapper xz ];

  phases = "installPhase";

  installPhase = ''
    mkdir -p $out
    dpkg-deb -x $src $out
    mv $out/usr/* $out/
    rmdir $out/usr
    substituteInPlace "$out/bin/steam" --replace "/bin/bash" "/bin/sh"
    substituteInPlace "$out/bin/steam" --replace "/usr/" "$out/"
    substituteInPlace "$out/bin/steam" --replace "\`basename \$0\`" "steam"
    sed -i '/jockey-common/d' $out/bin/steam
    wrapProgram "$out/bin/steam" --prefix PATH ":" \
      "${xz}/bin"
  '';

  meta = {
    description = "A digital distribution platform";
    homepage = http://store.steampowered.com/;
    license = "unfree";
  };
}