diff options
author | Tad Fisher <tadfisher@gmail.com> | 2018-04-12 15:32:14 -0700 |
---|---|---|
committer | Tad Fisher <tadfisher@gmail.com> | 2018-09-08 13:39:32 -0700 |
commit | 0b2b7b2d537ddc988cae617e33918e1c73a23c13 (patch) | |
tree | a2875fcb395ec5d327b2c6c52d853e9f719f80bf | |
parent | ca2ba44cab47767c8127d1c8633e2b581644eb8f (diff) |
steamcmd: init at 20180104
-rw-r--r-- | pkgs/games/steam/default.nix | 1 | ||||
-rw-r--r-- | pkgs/games/steam/steamcmd.nix | 46 | ||||
-rw-r--r-- | pkgs/games/steam/steamcmd.sh | 24 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
4 files changed, 73 insertions, 0 deletions
diff --git a/pkgs/games/steam/default.nix b/pkgs/games/steam/default.nix index e8a911bebd5ed..5aab54b832210 100644 --- a/pkgs/games/steam/default.nix +++ b/pkgs/games/steam/default.nix @@ -19,6 +19,7 @@ let then pkgs.pkgsi686Linux.steamPackages.steam-runtime-wrapped else null; }; + steamcmd = callPackage ./steamcmd.nix { }; }; in self diff --git a/pkgs/games/steam/steamcmd.nix b/pkgs/games/steam/steamcmd.nix new file mode 100644 index 0000000000000..6a2c7fe01b4f2 --- /dev/null +++ b/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 ]; + }; +} diff --git a/pkgs/games/steam/steamcmd.sh b/pkgs/games/steam/steamcmd.sh new file mode 100644 index 0000000000000..e092a4fedbe9b --- /dev/null +++ b/pkgs/games/steam/steamcmd.sh @@ -0,0 +1,24 @@ +#!@bash@/bin/bash -e + +# Always run steamcmd in the user's Steam root. +STEAMROOT=@steamRoot@ + +# Create a facsimile Steam root if it doesn't exist. +if [ ! -e "$STEAMROOT" ]; then + mkdir -p "$STEAMROOT"/{appcache,config,logs,Steamapps/common} + mkdir -p ~/.steam + ln -sf "$STEAMROOT" ~/.steam/root + ln -sf "$STEAMROOT" ~/.steam/steam +fi + +# Copy the system steamcmd install to the Steam root. If we don't do +# this, steamcmd assumes the path to `steamcmd` is the Steam root. +# Note that symlinks don't work here. +if [ ! -e "$STEAMROOT/steamcmd.sh" ]; then + mkdir -p "$STEAMROOT/linux32" + # steamcmd.sh will replace these on first use + cp @out@/share/steamcmd/steamcmd.sh "$STEAMROOT/." + cp @out@/share/steamcmd/linux32/* "$STEAMROOT/linux32/." +fi + +@steamRun@/bin/steam-run "$STEAMROOT/steamcmd.sh" "$@" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e3cb6069caf8d..7aefe4edd6672 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -20210,6 +20210,8 @@ with pkgs; nativeOnly = true; }).run; + steamcmd = steamPackages.steamcmd; + linux-steam-integration = callPackage ../games/linux-steam-integration { gtk = pkgs.gtk3; }; |