git.iko.soy/typeable/nixpkgs
on master help sign in
steam-run: refactor, remove unneeded files and dependencies
commitff0995707df9521074e5d7bbf42a0f4a5b8e07fe authorNikolay Amiantov <ab@fmap.me> dateThu 26 May 2016, 14:33 (11 years ago) parent1ab408e
1 file changed+78−75
pkgs/games/steam/chrootenv.nix+78−75
pkgs/games/steam/chrootenv.nix+78−75
@@ -8,90 +8,93 @@
88}:
99
1010let
11− self = {
12− name = "steam";
11+ commonTargetPkgs = pkgs: with pkgs; [
12+ steamPackages.steam-fonts
13+ # Errors in output without those
14+ pciutils
15+ python2
16+ # Games' dependencies
17+ xlibs.xrandr
18+ which
19+ # Needed by gdialog, including in the steam-runtime
20+ perl
21+ # Open URLs
22+ xdg_utils
23+ ];
1324
14− targetPkgs = pkgs: with pkgs; [
15− steamPackages.steam
16− steamPackages.steam-fonts
17− # License agreement
18− gnome3.zenity
19− # Errors in output without those
20− pciutils
21− python2
22− # Games' dependencies
23− xlibs.xrandr
24− which
25− # Needed by gdialog, including in the steam-runtime
26− perl
27− # Open URLs
28− xdg_utils
29− ] ++ lib.optional withJava jdk
30− ++ lib.optional withPrimus (primus.override {
31− stdenv = overrideInStdenv stdenv [ useOldCXXAbi ];
32− stdenv_i686 = overrideInStdenv pkgsi686Linux.stdenv [ useOldCXXAbi ];
33− });
25+in buildFHSUserEnv rec {
26+ name = "steam";
3427
35− multiPkgs = pkgs: with pkgs; [
36− # These are required by steam with proper errors
37− xlibs.libXcomposite
38− xlibs.libXtst
39− xlibs.libXrandr
40− xlibs.libXext
41− xlibs.libX11
42− xlibs.libXfixes
28+ targetPkgs = pkgs: with pkgs; [
29+ steamPackages.steam
30+ # License agreement
31+ gnome3.zenity
32+ ] ++ commonTargetPkgs pkgs
33+ ++ lib.optional withJava jdk
34+ ++ lib.optional withPrimus (primus.override {
35+ stdenv = overrideInStdenv stdenv [ useOldCXXAbi ];
36+ stdenv_i686 = overrideInStdenv pkgsi686Linux.stdenv [ useOldCXXAbi ];
37+ });
4338
44− # Not formally in runtime but needed by some games
45− gst_all_1.gstreamer
46− gst_all_1.gst-plugins-ugly
47− libdrm
39+ multiPkgs = pkgs: with pkgs; [
40+ # These are required by steam with proper errors
41+ xlibs.libXcomposite
42+ xlibs.libXtst
43+ xlibs.libXrandr
44+ xlibs.libXext
45+ xlibs.libX11
46+ xlibs.libXfixes
4847
49− (steamPackages.steam-runtime-wrapped.override {
50− inherit nativeOnly runtimeOnly newStdcpp;
51− })
52− ];
48+ # Not formally in runtime but needed by some games
49+ gst_all_1.gstreamer
50+ gst_all_1.gst-plugins-ugly
51+ libdrm
5352
54− extraBuildCommands = ''
55− mkdir -p steamrt
56− ln -s ../lib/steam-runtime steamrt/${steam-runtime.arch}
57− ${lib.optionalString (steam-runtime-i686 != null) ''
58− ln -s ../lib32/steam-runtime steamrt/${steam-runtime-i686.arch}
59− ''}
60− '';
53+ (steamPackages.steam-runtime-wrapped.override {
54+ inherit nativeOnly runtimeOnly newStdcpp;
55+ })
56+ ];
6157
62− extraInstallCommands = ''
63− mkdir -p $out/share/applications
64− ln -s ${steam}/share/icons $out/share
65− ln -s ${steam}/share/pixmaps $out/share
66− sed "s,/usr/bin/steam,$out/bin/steam,g" ${steam}/share/applications/steam.desktop > $out/share/applications/steam.desktop
67− '';
58+ extraBuildCommands = ''
59+ mkdir -p steamrt
60+ ln -s ../lib/steam-runtime steamrt/${steam-runtime.arch}
61+ ${lib.optionalString (steam-runtime-i686 != null) ''
62+ ln -s ../lib32/steam-runtime steamrt/${steam-runtime-i686.arch}
63+ ''}
64+ '';
6865
69− profile = ''
70− export STEAM_RUNTIME=/steamrt
71− '';
66+ extraInstallCommands = ''
67+ mkdir -p $out/share/applications
68+ ln -s ${steam}/share/icons $out/share
69+ ln -s ${steam}/share/pixmaps $out/share
70+ sed "s,/usr/bin/steam,$out/bin/steam,g" ${steam}/share/applications/steam.desktop > $out/share/applications/steam.desktop
71+ '';
7272
73− runScript = "steam";
73+ profile = ''
74+ export STEAM_RUNTIME=/steamrt
75+ '';
7476
75− passthru.run = buildFHSUserEnv (self // {
76− name = "steam-run";
77+ runScript = "steam";
7778
78− runScript =
79− let ldPath = map (x: "/steamrt/${steam-runtime.arch}/" + x) steam-runtime.libs
80− ++ lib.optionals (steam-runtime-i686 != null) (map (x: "/steamrt/${steam-runtime-i686.arch}/" + x) steam-runtime-i686.libs);
81− in writeScript "steam-run" ''
82− #!${stdenv.shell}
83− run="$1"
84− if [ "$run" = "" ]; then
85− echo "Usage: steam-run command-to-run args..." >&2
86− exit 1
87− fi
88− shift
89− export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH
90− exec "$run" "$@"
91− '';
79+ passthru.run = buildFHSUserEnv {
80+ name = "steam-run";
9281
93− passthru = {};
94− });
95− };
82+ targetPkgs = commonTargetPkgs;
83+ inherit multiPkgs extraBuildCommands;
9684
97−in buildFHSUserEnv self
85+ runScript =
86+ let ldPath = map (x: "/steamrt/${steam-runtime.arch}/" + x) steam-runtime.libs
87+ ++ lib.optionals (steam-runtime-i686 != null) (map (x: "/steamrt/${steam-runtime-i686.arch}/" + x) steam-runtime-i686.libs);
88+ in writeScript "steam-run" ''
89+ #!${stdenv.shell}
90+ run="$1"
91+ if [ "$run" = "" ]; then
92+ echo "Usage: steam-run command-to-run args..." >&2
93+ exit 1
94+ fi
95+ shift
96+ export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH
97+ exec "$run" "$@"
98+ '';
99+ };
100+}