about summary refs log tree commit diff
path: root/nixpkgs/pkgs/games/steam/steamcmd.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/games/steam/steamcmd.nix')
-rw-r--r--nixpkgs/pkgs/games/steam/steamcmd.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/games/steam/steamcmd.nix b/nixpkgs/pkgs/games/steam/steamcmd.nix
new file mode 100644
index 000000000000..6a2c7fe01b4f
--- /dev/null
+++ b/nixpkgs/pkgs/games/steam/steamcmd.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, steam-run, bash
+, steamRoot ? "~/.local/share/Steam"
+}:
+
+stdenv.mkDerivation rec {
+  name = "steamcmd-${version}";
+  version = "20180104"; # According to steamcmd_linux.tar.gz mtime
+
+  src = fetchurl {
+    url = https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz;
+    sha256 = "0z0y0zqvhydmfc9y9vg5am0vz7m3gbj4l2dwlrfz936hpx301gyf";
+  };
+
+  # The source tarball does not have a single top-level directory.
+  preUnpack = ''
+    mkdir $name
+    cd $name
+    sourceRoot=.
+  '';
+
+  buildInputs = [ bash steam-run ];
+
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p $out/share/steamcmd/linux32
+    install -Dm755 steamcmd.sh $out/share/steamcmd/steamcmd.sh
+    install -Dm755 linux32/* $out/share/steamcmd/linux32
+
+    mkdir -p $out/bin
+    substitute ${./steamcmd.sh} $out/bin/steamcmd \
+      --subst-var shell \
+      --subst-var out \
+      --subst-var-by steamRoot "${steamRoot}" \
+      --subst-var-by steamRun ${steam-run}
+    chmod 0755 $out/bin/steamcmd
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Steam command-line tools";
+    homepage = "https://developer.valvesoftware.com/wiki/SteamCMD";
+    platforms = platforms.linux;
+    license = licenses.unfreeRedistributable;
+    maintainers = with maintainers; [ tadfisher ];
+  };
+}