Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / games / steam / steamcmd.nix
blob1c834f1c2ea69b54071a0ca86a695a8a8148898a
1 { lib, stdenv, fetchurl, steam-run, bash, coreutils
2 , steamRoot ? "~/.local/share/Steam"
3 }:
5 stdenv.mkDerivation {
6   pname = "steamcmd";
7   version = "20180104"; # According to steamcmd_linux.tar.gz mtime
9   src = fetchurl {
10     url = "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz";
11     sha256 = "0z0y0zqvhydmfc9y9vg5am0vz7m3gbj4l2dwlrfz936hpx301gyf";
12   };
14   # The source tarball does not have a single top-level directory.
15   preUnpack = ''
16     mkdir $name
17     cd $name
18     sourceRoot=.
19   '';
21   buildInputs = [ bash steam-run ];
23   dontBuild = true;
25   installPhase = ''
26     mkdir -p $out/share/steamcmd/linux32
27     install -Dm755 steamcmd.sh $out/share/steamcmd/steamcmd.sh
28     install -Dm755 linux32/* $out/share/steamcmd/linux32
30     mkdir -p $out/bin
31     substitute ${./steamcmd.sh} $out/bin/steamcmd \
32       --subst-var out \
33       --subst-var-by coreutils ${coreutils} \
34       --subst-var-by steamRoot "${steamRoot}" \
35       --subst-var-by steamRun ${steam-run}
36     chmod 0755 $out/bin/steamcmd
37   '';
39   meta = with lib; {
40     description = "Steam command-line tools";
41     homepage = "https://developer.valvesoftware.com/wiki/SteamCMD";
42     platforms = platforms.linux;
43     license = licenses.unfreeRedistributable;
44     maintainers = with maintainers; [ tadfisher ];
45   };