git.iko.soy/typeable/nixpkgs
on master help sign in
steam-run: add derivation
commit192e0c714164a2e537ba3566306c24d9ff888ace authorNikolay Amiantov <ab@fmap.me> dateSun 3 Apr 2016, 04:19 (11 years ago) parent375c410
3 files changed+61−29
pkgs/games/steam/chrootenv.nix+52−28 pkgs/games/steam/default.nix+6−1 pkgs/top-level/all-packages.nix+3
pkgs/games/steam/chrootenv.nix+52−28
@@ -1,4 +1,5 @@
1−{ lib, buildFHSUserEnv, steam
1+{ stdenv, lib, writeScript, buildFHSUserEnv, steam
2+, steam-runtime, steam-runtime-i686 ? null
23, withJava ? false
34, withPrimus ? false
45, nativeOnly ? false
@@ -6,10 +7,11 @@
67, newStdcpp ? false
78}:
89
9−buildFHSUserEnv {
10− name = "steam";
10+let
11+ self = {
12+ name = "steam";
1113
12− targetPkgs = pkgs: with pkgs; [
14+ targetPkgs = pkgs: with pkgs; [
1315 steamPackages.steam
1416 steamPackages.steam-fonts
1517 # License agreement
@@ -22,15 +24,13 @@ buildFHSUserEnv {
2224 which
2325 # Needed by gdialog, including in the steam-runtime
2426 perl
25− ]
26− ++ lib.optional withJava jdk
27− ++ lib.optional withPrimus (primus.override {
28− stdenv = overrideInStdenv stdenv [ useOldCXXAbi ];
29− stdenv_i686 = overrideInStdenv pkgsi686Linux.stdenv [ useOldCXXAbi ];
30− })
31− ;
27+ ] ++ lib.optional withJava jdk
28+ ++ lib.optional withPrimus (primus.override {
29+ stdenv = overrideInStdenv stdenv [ useOldCXXAbi ];
30+ stdenv_i686 = overrideInStdenv pkgsi686Linux.stdenv [ useOldCXXAbi ];
31+ });
3232
33− multiPkgs = pkgs: with pkgs; [
33+ multiPkgs = pkgs: with pkgs; [
3434 # These are required by steam with proper errors
3535 xlibs.libXcomposite
3636 xlibs.libXtst
@@ -49,23 +49,47 @@ buildFHSUserEnv {
4949 })
5050 ];
5151
52− extraBuildCommands = ''
53− mkdir -p steamrt
52+ extraBuildCommands = ''
53+ mkdir -p steamrt
54+ ln -s ../lib/steam-runtime steamrt/${steam-runtime.arch}
55+ ${lib.optionalString (steam-runtime-i686 != null) ''
56+ ln -s ../lib32/steam-runtime steamrt/${steam-runtime-i686.arch}
57+ ''}
58+ '';
5459
55− ln -s ../lib64/steam-runtime steamrt/amd64
56− ln -s ../lib32/steam-runtime steamrt/i386
57− '';
60+ extraInstallCommands = ''
61+ mkdir -p $out/share/applications
62+ ln -s ${steam}/share/icons $out/share
63+ ln -s ${steam}/share/pixmaps $out/share
64+ sed "s,/usr/bin/steam,$out/bin/steam,g" ${steam}/share/applications/steam.desktop > $out/share/applications/steam.desktop
65+ '';
5866
59− extraInstallCommands = ''
60− mkdir -p $out/share/applications
61− ln -s ${steam}/share/icons $out/share
62− ln -s ${steam}/share/pixmaps $out/share
63− sed "s,/usr/bin/steam,$out/bin/steam,g" ${steam}/share/applications/steam.desktop > $out/share/applications/steam.desktop
64− '';
67+ profile = ''
68+ export STEAM_RUNTIME=/steamrt
69+ '';
6570
66− profile = ''
67− export STEAM_RUNTIME=/steamrt
68− '';
71+ runScript = "steam";
6972
70− runScript = "steam";
71−}
73+ passthru.run = buildFHSUserEnv (self // {
74+ name = "steam-run";
75+
76+ runScript =
77+ let ldPath = map (x: "/steamrt/${steam-runtime.arch}/" + x) steam-runtime.libs
78+ ++ lib.optionals (steam-runtime-i686 != null) (map (x: "/steamrt/${steam-runtime-i686.arch}/" + x) steam-runtime-i686.libs);
79+ in writeScript "steam-run" ''
80+ #!${stdenv.shell}
81+ run="$1"
82+ if [ "$run" = "" ]; then
83+ echo "Usage: steam-run command-to-run args..." >&2
84+ exit 1
85+ fi
86+ shift
87+ export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH
88+ exec "$run" "$@"
89+ '';
90+
91+ passthru = {};
92+ });
93+ };
94+
95+in buildFHSUserEnv self
pkgs/games/steam/default.nix+6−1
@@ -7,8 +7,13 @@ let
77 steam-runtime = callPackage ./runtime.nix { };
88 steam-runtime-wrapped = callPackage ./runtime-wrapped.nix { };
99 steam = callPackage ./steam.nix { };
10− steam-chrootenv = callPackage ./chrootenv.nix { };
1110 steam-fonts = callPackage ./fonts.nix { };
11+ steam-chrootenv = callPackage ./chrootenv.nix {
12+ steam-runtime-i686 =
13+ if pkgs.system == "x86_64-linux"
14+ then pkgs.pkgsi686Linux.steamPackages.steam-runtime
15+ else null;
16+ };
1217 };
1318
1419in self
pkgs/top-level/all-packages.nix+3
@@ -14896,12 +14896,15 @@ in
1489614896 stockfish = callPackage ../games/stockfish { };
1489714897
1489814898 steamPackages = callPackage ../games/steam { };
14899+
1489914900 steam = steamPackages.steam-chrootenv.override {
1490014901 # DEPRECATED
1490114902 withJava = config.steam.java or false;
1490214903 withPrimus = config.steam.primus or false;
1490314904 };
1490414905
14906+ steam-run = steam.run;
14907+
1490514908 stepmania = callPackage ../games/stepmania { };
1490614909
1490714910 stuntrally = callPackage ../games/stuntrally { };