steam-run: refactor, remove unneeded files and dependencies
This commit is contained in:
parent
1ab408e1da
commit
ff0995707d
@ -8,90 +8,93 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
self = {
|
commonTargetPkgs = pkgs: with pkgs; [
|
||||||
name = "steam";
|
steamPackages.steam-fonts
|
||||||
|
# Errors in output without those
|
||||||
|
pciutils
|
||||||
|
python2
|
||||||
|
# Games' dependencies
|
||||||
|
xlibs.xrandr
|
||||||
|
which
|
||||||
|
# Needed by gdialog, including in the steam-runtime
|
||||||
|
perl
|
||||||
|
# Open URLs
|
||||||
|
xdg_utils
|
||||||
|
];
|
||||||
|
|
||||||
targetPkgs = pkgs: with pkgs; [
|
in buildFHSUserEnv rec {
|
||||||
steamPackages.steam
|
name = "steam";
|
||||||
steamPackages.steam-fonts
|
|
||||||
# License agreement
|
|
||||||
gnome3.zenity
|
|
||||||
# Errors in output without those
|
|
||||||
pciutils
|
|
||||||
python2
|
|
||||||
# Games' dependencies
|
|
||||||
xlibs.xrandr
|
|
||||||
which
|
|
||||||
# Needed by gdialog, including in the steam-runtime
|
|
||||||
perl
|
|
||||||
# Open URLs
|
|
||||||
xdg_utils
|
|
||||||
] ++ lib.optional withJava jdk
|
|
||||||
++ lib.optional withPrimus (primus.override {
|
|
||||||
stdenv = overrideInStdenv stdenv [ useOldCXXAbi ];
|
|
||||||
stdenv_i686 = overrideInStdenv pkgsi686Linux.stdenv [ useOldCXXAbi ];
|
|
||||||
});
|
|
||||||
|
|
||||||
multiPkgs = pkgs: with pkgs; [
|
targetPkgs = pkgs: with pkgs; [
|
||||||
# These are required by steam with proper errors
|
steamPackages.steam
|
||||||
xlibs.libXcomposite
|
# License agreement
|
||||||
xlibs.libXtst
|
gnome3.zenity
|
||||||
xlibs.libXrandr
|
] ++ commonTargetPkgs pkgs
|
||||||
xlibs.libXext
|
++ lib.optional withJava jdk
|
||||||
xlibs.libX11
|
++ lib.optional withPrimus (primus.override {
|
||||||
xlibs.libXfixes
|
stdenv = overrideInStdenv stdenv [ useOldCXXAbi ];
|
||||||
|
stdenv_i686 = overrideInStdenv pkgsi686Linux.stdenv [ useOldCXXAbi ];
|
||||||
|
});
|
||||||
|
|
||||||
# Not formally in runtime but needed by some games
|
multiPkgs = pkgs: with pkgs; [
|
||||||
gst_all_1.gstreamer
|
# These are required by steam with proper errors
|
||||||
gst_all_1.gst-plugins-ugly
|
xlibs.libXcomposite
|
||||||
libdrm
|
xlibs.libXtst
|
||||||
|
xlibs.libXrandr
|
||||||
|
xlibs.libXext
|
||||||
|
xlibs.libX11
|
||||||
|
xlibs.libXfixes
|
||||||
|
|
||||||
(steamPackages.steam-runtime-wrapped.override {
|
# Not formally in runtime but needed by some games
|
||||||
inherit nativeOnly runtimeOnly newStdcpp;
|
gst_all_1.gstreamer
|
||||||
})
|
gst_all_1.gst-plugins-ugly
|
||||||
];
|
libdrm
|
||||||
|
|
||||||
extraBuildCommands = ''
|
(steamPackages.steam-runtime-wrapped.override {
|
||||||
mkdir -p steamrt
|
inherit nativeOnly runtimeOnly newStdcpp;
|
||||||
ln -s ../lib/steam-runtime steamrt/${steam-runtime.arch}
|
})
|
||||||
${lib.optionalString (steam-runtime-i686 != null) ''
|
];
|
||||||
ln -s ../lib32/steam-runtime steamrt/${steam-runtime-i686.arch}
|
|
||||||
''}
|
|
||||||
'';
|
|
||||||
|
|
||||||
extraInstallCommands = ''
|
extraBuildCommands = ''
|
||||||
mkdir -p $out/share/applications
|
mkdir -p steamrt
|
||||||
ln -s ${steam}/share/icons $out/share
|
ln -s ../lib/steam-runtime steamrt/${steam-runtime.arch}
|
||||||
ln -s ${steam}/share/pixmaps $out/share
|
${lib.optionalString (steam-runtime-i686 != null) ''
|
||||||
sed "s,/usr/bin/steam,$out/bin/steam,g" ${steam}/share/applications/steam.desktop > $out/share/applications/steam.desktop
|
ln -s ../lib32/steam-runtime steamrt/${steam-runtime-i686.arch}
|
||||||
'';
|
''}
|
||||||
|
'';
|
||||||
|
|
||||||
profile = ''
|
extraInstallCommands = ''
|
||||||
export STEAM_RUNTIME=/steamrt
|
mkdir -p $out/share/applications
|
||||||
'';
|
ln -s ${steam}/share/icons $out/share
|
||||||
|
ln -s ${steam}/share/pixmaps $out/share
|
||||||
|
sed "s,/usr/bin/steam,$out/bin/steam,g" ${steam}/share/applications/steam.desktop > $out/share/applications/steam.desktop
|
||||||
|
'';
|
||||||
|
|
||||||
runScript = "steam";
|
profile = ''
|
||||||
|
export STEAM_RUNTIME=/steamrt
|
||||||
|
'';
|
||||||
|
|
||||||
passthru.run = buildFHSUserEnv (self // {
|
runScript = "steam";
|
||||||
name = "steam-run";
|
|
||||||
|
|
||||||
runScript =
|
passthru.run = buildFHSUserEnv {
|
||||||
let ldPath = map (x: "/steamrt/${steam-runtime.arch}/" + x) steam-runtime.libs
|
name = "steam-run";
|
||||||
++ lib.optionals (steam-runtime-i686 != null) (map (x: "/steamrt/${steam-runtime-i686.arch}/" + x) steam-runtime-i686.libs);
|
|
||||||
in writeScript "steam-run" ''
|
|
||||||
#!${stdenv.shell}
|
|
||||||
run="$1"
|
|
||||||
if [ "$run" = "" ]; then
|
|
||||||
echo "Usage: steam-run command-to-run args..." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH
|
|
||||||
exec "$run" "$@"
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru = {};
|
targetPkgs = commonTargetPkgs;
|
||||||
});
|
inherit multiPkgs extraBuildCommands;
|
||||||
|
|
||||||
|
runScript =
|
||||||
|
let ldPath = map (x: "/steamrt/${steam-runtime.arch}/" + x) steam-runtime.libs
|
||||||
|
++ lib.optionals (steam-runtime-i686 != null) (map (x: "/steamrt/${steam-runtime-i686.arch}/" + x) steam-runtime-i686.libs);
|
||||||
|
in writeScript "steam-run" ''
|
||||||
|
#!${stdenv.shell}
|
||||||
|
run="$1"
|
||||||
|
if [ "$run" = "" ]; then
|
||||||
|
echo "Usage: steam-run command-to-run args..." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH
|
||||||
|
exec "$run" "$@"
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
}
|
||||||
in buildFHSUserEnv self
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user