git.iko.soy/typeable/nixpkgs
on master help sign in
steam-run: refactor, remove unneeded files and dependencies
ff09957Nikolay Amiantov
pkgs/games/steam/chrootenv.nix+78−75
@@ -8,90 +8,93 @@
8}:
8}:
9
9
10let
10let
11− self = {
11+ commonTargetPkgs = pkgs: with pkgs; [
12− name = "steam";
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+ ];
13
24
14− targetPkgs = pkgs: with pkgs; [
25+in buildFHSUserEnv rec {
15− steamPackages.steam
26+ name = "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− });
34
27
35− multiPkgs = pkgs: with pkgs; [
28+ targetPkgs = pkgs: with pkgs; [
36− # These are required by steam with proper errors
29+ steamPackages.steam
37− xlibs.libXcomposite
30+ # License agreement
38− xlibs.libXtst
31+ gnome3.zenity
39− xlibs.libXrandr
32+ ] ++ commonTargetPkgs pkgs
40− xlibs.libXext
33+ ++ lib.optional withJava jdk
41− xlibs.libX11
34+ ++ lib.optional withPrimus (primus.override {
42− xlibs.libXfixes
35+ stdenv = overrideInStdenv stdenv [ useOldCXXAbi ];
36+ stdenv_i686 = overrideInStdenv pkgsi686Linux.stdenv [ useOldCXXAbi ];
37+ });
43
38
44− # Not formally in runtime but needed by some games
39+ multiPkgs = pkgs: with pkgs; [
45− gst_all_1.gstreamer
40+ # These are required by steam with proper errors
46− gst_all_1.gst-plugins-ugly
41+ xlibs.libXcomposite
47− libdrm
42+ xlibs.libXtst
43+ xlibs.libXrandr
44+ xlibs.libXext
45+ xlibs.libX11
46+ xlibs.libXfixes
48
47
49− (steamPackages.steam-runtime-wrapped.override {
48+ # Not formally in runtime but needed by some games
50− inherit nativeOnly runtimeOnly newStdcpp;
49+ gst_all_1.gstreamer
51− })
50+ gst_all_1.gst-plugins-ugly
52− ];
51+ libdrm
53
52
54− extraBuildCommands = ''
53+ (steamPackages.steam-runtime-wrapped.override {
55− mkdir -p steamrt
54+ inherit nativeOnly runtimeOnly newStdcpp;
56− ln -s ../lib/steam-runtime steamrt/${steam-runtime.arch}
55+ })
57− ${lib.optionalString (steam-runtime-i686 != null) ''
58− ln -s ../lib32/steam-runtime steamrt/${steam-runtime-i686.arch}
59− ''}
60− '';
56+ ];
61
57
62− extraInstallCommands = ''
58+ extraBuildCommands = ''
63− mkdir -p $out/share/applications
59+ mkdir -p steamrt
64− ln -s ${steam}/share/icons $out/share
60+ ln -s ../lib/steam-runtime steamrt/${steam-runtime.arch}
65− ln -s ${steam}/share/pixmaps $out/share
61+ ${lib.optionalString (steam-runtime-i686 != null) ''
66− sed "s,/usr/bin/steam,$out/bin/steam,g" ${steam}/share/applications/steam.desktop > $out/share/applications/steam.desktop
62+ ln -s ../lib32/steam-runtime steamrt/${steam-runtime-i686.arch}
67− '';
63+ ''}
64+ '';
68
65
69− profile = ''
66+ extraInstallCommands = ''
70− export STEAM_RUNTIME=/steamrt
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− '';
71+ '';
72
72
73− runScript = "steam";
73+ profile = ''
74+ export STEAM_RUNTIME=/steamrt
75+ '';
74
76
75− passthru.run = buildFHSUserEnv (self // {
77+ runScript = "steam";
76− name = "steam-run";
77
78
78− runScript =
79+ passthru.run = buildFHSUserEnv {
79− let ldPath = map (x: "/steamrt/${steam-runtime.arch}/" + x) steam-runtime.libs
80+ name = "steam-run";
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− '';
92
81
93− passthru = {};
82+ targetPkgs = commonTargetPkgs;
94− });
83+ inherit multiPkgs extraBuildCommands;
95− };
96
84
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+}