mindustry-wayland: set SDL environment variables
`SDL_VIDEODRIVER=wayland` seems to be a requirement for GLEW to initialize when using glew-egl. `SDL_VIDEO_WAYLAND_WMCLASS` associates the application with the .desktop file (in GNOME Shell, at least, if not other Wayland desktops).
This commit is contained in:
parent
735627c5c7
commit
729d2eea29
|
@ -15,6 +15,7 @@
|
||||||
, alsa-lib
|
, alsa-lib
|
||||||
, alsa-plugins
|
, alsa-plugins
|
||||||
, glew
|
, glew
|
||||||
|
, glew-egl
|
||||||
|
|
||||||
# for soloud
|
# for soloud
|
||||||
, libpulseaudio ? null
|
, libpulseaudio ? null
|
||||||
|
@ -30,6 +31,8 @@
|
||||||
, makeBuildVersion ? (v: v)
|
, makeBuildVersion ? (v: v)
|
||||||
, enableClient ? true
|
, enableClient ? true
|
||||||
, enableServer ? true
|
, enableServer ? true
|
||||||
|
|
||||||
|
, enableWayland ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -37,6 +40,8 @@ let
|
||||||
version = "142";
|
version = "142";
|
||||||
buildVersion = makeBuildVersion version;
|
buildVersion = makeBuildVersion version;
|
||||||
|
|
||||||
|
selectedGlew = if enableWayland then glew-egl else glew;
|
||||||
|
|
||||||
Mindustry = fetchFromGitHub {
|
Mindustry = fetchFromGitHub {
|
||||||
owner = "Anuken";
|
owner = "Anuken";
|
||||||
repo = "Mindustry";
|
repo = "Mindustry";
|
||||||
|
@ -139,7 +144,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
buildInputs = lib.optionals enableClient [
|
buildInputs = lib.optionals enableClient [
|
||||||
SDL2
|
SDL2
|
||||||
glew
|
selectedGlew
|
||||||
alsa-lib
|
alsa-lib
|
||||||
];
|
];
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
@ -171,7 +176,7 @@ stdenv.mkDerivation rec {
|
||||||
pushd ../Arc
|
pushd ../Arc
|
||||||
gradle --offline --no-daemon jnigenBuild -Pbuildversion=${buildVersion}
|
gradle --offline --no-daemon jnigenBuild -Pbuildversion=${buildVersion}
|
||||||
gradle --offline --no-daemon jnigenJarNativesDesktop -Pbuildversion=${buildVersion}
|
gradle --offline --no-daemon jnigenJarNativesDesktop -Pbuildversion=${buildVersion}
|
||||||
glewlib=${lib.getLib glew}/lib/libGLEW.so
|
glewlib=${lib.getLib selectedGlew}/lib/libGLEW.so
|
||||||
sdllib=${lib.getLib SDL2}/lib/libSDL2.so
|
sdllib=${lib.getLib SDL2}/lib/libSDL2.so
|
||||||
patchelf backends/backend-sdl/libs/linux64/libsdl-arc*.so \
|
patchelf backends/backend-sdl/libs/linux64/libsdl-arc*.so \
|
||||||
--add-needed $glewlib \
|
--add-needed $glewlib \
|
||||||
|
@ -194,7 +199,10 @@ stdenv.mkDerivation rec {
|
||||||
makeWrapper ${jdk}/bin/java $out/bin/mindustry \
|
makeWrapper ${jdk}/bin/java $out/bin/mindustry \
|
||||||
--add-flags "-jar $out/share/mindustry.jar" \
|
--add-flags "-jar $out/share/mindustry.jar" \
|
||||||
--suffix LD_LIBRARY_PATH : ${lib.makeLibraryPath [libpulseaudio alsa-lib libjack2]} \
|
--suffix LD_LIBRARY_PATH : ${lib.makeLibraryPath [libpulseaudio alsa-lib libjack2]} \
|
||||||
--set ALSA_PLUGIN_DIR ${alsa-plugins}/lib/alsa-lib/
|
--set ALSA_PLUGIN_DIR ${alsa-plugins}/lib/alsa-lib/'' + optionalString enableWayland '' \
|
||||||
|
--set SDL_VIDEODRIVER wayland \
|
||||||
|
--set SDL_VIDEO_WAYLAND_WMCLASS Mindustry
|
||||||
|
'' + ''
|
||||||
|
|
||||||
# Retain runtime depends to prevent them from being cleaned up.
|
# Retain runtime depends to prevent them from being cleaned up.
|
||||||
# Since a jar is a compressed archive, nix can't figure out that the dependency is actually in there,
|
# Since a jar is a compressed archive, nix can't figure out that the dependency is actually in there,
|
||||||
|
@ -202,7 +210,7 @@ stdenv.mkDerivation rec {
|
||||||
# This can cause issues.
|
# This can cause issues.
|
||||||
# See https://github.com/NixOS/nixpkgs/issues/109798.
|
# See https://github.com/NixOS/nixpkgs/issues/109798.
|
||||||
echo "# Retained runtime dependencies: " >> $out/bin/mindustry
|
echo "# Retained runtime dependencies: " >> $out/bin/mindustry
|
||||||
for dep in ${SDL2.out} ${alsa-lib.out} ${glew.out}; do
|
for dep in ${SDL2.out} ${alsa-lib.out} ${selectedGlew.out}; do
|
||||||
echo "# $dep" >> $out/bin/mindustry
|
echo "# $dep" >> $out/bin/mindustry
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -35754,7 +35754,7 @@ with pkgs;
|
||||||
|
|
||||||
mindustry = callPackage ../games/mindustry { };
|
mindustry = callPackage ../games/mindustry { };
|
||||||
mindustry-wayland = callPackage ../games/mindustry {
|
mindustry-wayland = callPackage ../games/mindustry {
|
||||||
glew = glew-egl;
|
enableWayland = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
mindustry-server = callPackage ../games/mindustry {
|
mindustry-server = callPackage ../games/mindustry {
|
||||||
|
|
Loading…
Reference in a new issue