oh well, havent seen yet. so that won’t work…
Thanks for the amazing explanation @jchw. nix-ld is great if you just want to use your system without headaches and I’ve thought about using it before. I guess my only reservation with it would be not being able to tell if a binary would fail normally.
If I had it installed, does unsetting NIX_LD
and NIX_LD_LIBRARY_PATH
turn nix-ld off?
If that’s the case, would I be able to turn it on by sourcing them when I need to?
Correct, unsetting NIX_LD
or NIX_LD_LIBRARY_PATH
will render Nix-LD ineffective.
If you want, you can use Nix-LD with nothing in the global NIX_LD_LIBRARY_PATH
and use a flake or similar to set up specific environments instead. This sort of setup is documented at the official Nix-LD page.
Unfortunately, there’s no way to do this for the /bin/bash shim I also have in my setup, but it’d probably be a good idea to come up with an escape hatch for that, too. It’s often also needed to run random stuff.
Thanks, this is pretty useful. I’ll give it a try sometime soon.
I have been reading through this thread, but I’m still confused about one thing, is ATLauncher not working as expected because the Discord integration is failing? If so, @eljamm is this happening on your system due to the same issue? I haven’t noticed this on my system.
No, I don’t think it’s because of discord integration, as adding discord-rpc
or disabling the option in the launcher fixes that. For me, it’s crashing with:
GLFW error 65542: GLX: Failed to load GLX.
Edit: I’ve set up nix-ld in a shell with theese packages:
But it still crashes for me.
Maybe worth trying to run it with LD_DEBUG=libs
, perhaps we can find out why GLX isn’t able to be loaded.
These are the only GLX entries I get when running with LD_DEBUG=libs
:
[15/05/2024 17:48:44 PM] 1552**ACCESSTOKEN**19: find library=libGLX.so.**ACCESSTOKEN** [**ACCESSTOKEN**]; searching
[15/05/2024 17:48:44 PM] 1552**ACCESSTOKEN**19: trying file=/nix/store/6v6k2g45hrxazgbbw3zyv6pl8914**ACCESSTOKEN**v1y-libXxf86vm-1.1.5/lib/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:48:44 PM] 1552**ACCESSTOKEN**19: trying file=/nix/store/lsp7hk1ppjv4**ACCESSTOKEN**3q8h191p929wycbk**ACCESSTOKEN**r3-systemd-minimal-libs-255.4/lib/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:48:44 PM] 1552**ACCESSTOKEN**19: trying file=/nix/store/msi95r4426zlfbmzr1a9v45b2vgqaail-discord-rpc-3.4.**ACCESSTOKEN**/lib/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:48:44 PM] 1552**ACCESSTOKEN**19: trying file=/nix/store/4ja9a94kxjqwm65c5bpnrnsa5rffb**ACCESSTOKEN**ij-glfw-3.4/lib/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:48:44 PM] 1552**ACCESSTOKEN**19: trying file=/nix/store/qvacibysn**ACCESSTOKEN**z5478vsbjcs35kh2bpykyk-pipewire-1.**ACCESSTOKEN**.5-jack/lib/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:48:44 PM] 1552**ACCESSTOKEN**19: trying file=/nix/store/apab5i73dqa**ACCESSTOKEN**9wx**ACCESSTOKEN**q27b6fbhd1r18ihl-glibc-2.39-31/lib/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:48:44 PM] 1552**ACCESSTOKEN**19: trying file=/nix/store/nrwkk6ak3rgkrxbqhsscb**ACCESSTOKEN**1jpzmslf2r-xgcc-13.2.**ACCESSTOKEN**-libgcc/lib/libGLX.so.**ACCESSTOKEN**
Edit: I ran the launcher with:
$ steam-run atlauncher
and the game worked…
Interesting: this should be provided by libglvnd
.
That is a reasonable solution; under the hood steam-run runs things in an FHS environment. It’s a bit heavy-handed but usually pretty effective.
If this is working, that means there’s some lib missing in the Nix derivation for ATLauncher. I’ll find what’s causing that. Must’ve been something in 3.4.36.3
I guess? I’m guessing you’ve also tried 3.4.36.4
?
When running with steam-run, there are more glx libraries, so I guess the ones from mesa get loaded in this case:
Summary
[15/05/2024 17:57:17 PM] 1553887: find library=libxcb-glx.so.**ACCESSTOKEN** [**ACCESSTOKEN**]; searching
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/6v6k2g45hrxazgbbw3zyv6pl8914**ACCESSTOKEN**v1y-libXxf86vm-1.1.5/lib/libxcb-glx.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/lsp7hk1ppjv4**ACCESSTOKEN**3q8h191p929wycbk**ACCESSTOKEN**r3-systemd-minimal-libs-255.4/lib/libxcb-glx.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/msi95r4426zlfbmzr1a9v45b2vgqaail-discord-rpc-3.4.**ACCESSTOKEN**/lib/libxcb-glx.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/4ja9a94kxjqwm65c5bpnrnsa5rffb**ACCESSTOKEN**ij-glfw-3.4/lib/libxcb-glx.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/lib64/libxcb-glx.so.**ACCESSTOKEN**
[15/05/2024 17:57:25 PM] 1553887: calling fini: /lib64/libGLX.so.**ACCESSTOKEN** [**ACCESSTOKEN**]
[15/05/2024 17:57:25 PM] 1553887: calling fini: /lib64/libGLX_mesa.so.**ACCESSTOKEN** [**ACCESSTOKEN**]
[15/05/2024 17:57:25 PM] 1553887: calling fini: /lib64/libxcb-glx.so.**ACCESSTOKEN** [**ACCESSTOKEN**]
[15/05/2024 17:57:17 PM] 1553887: find library=libGLX.so.**ACCESSTOKEN** [**ACCESSTOKEN**]; searching
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/6v6k2g45hrxazgbbw3zyv6pl8914**ACCESSTOKEN**v1y-libXxf86vm-1.1.5/lib/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/lsp7hk1ppjv4**ACCESSTOKEN**3q8h191p929wycbk**ACCESSTOKEN**r3-systemd-minimal-libs-255.4/lib/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/msi95r4426zlfbmzr1a9v45b2vgqaail-discord-rpc-3.4.**ACCESSTOKEN**/lib/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/4ja9a94kxjqwm65c5bpnrnsa5rffb**ACCESSTOKEN**ij-glfw-3.4/lib/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/lib64/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: calling init: /lib64/libGLX.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: find library=libGLX_mesa.so.**ACCESSTOKEN** [**ACCESSTOKEN**]; searching
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/6v6k2g45hrxazgbbw3zyv6pl8914**ACCESSTOKEN**v1y-libXxf86vm-1.1.5/lib/libGLX_mesa.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/lsp7hk1ppjv4**ACCESSTOKEN**3q8h191p929wycbk**ACCESSTOKEN**r3-systemd-minimal-libs-255.4/lib/libGLX_mesa.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/msi95r4426zlfbmzr1a9v45b2vgqaail-discord-rpc-3.4.**ACCESSTOKEN**/lib/libGLX_mesa.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/4ja9a94kxjqwm65c5bpnrnsa5rffb**ACCESSTOKEN**ij-glfw-3.4/lib/libGLX_mesa.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/lib64/libGLX_mesa.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: find library=libxcb-glx.so.**ACCESSTOKEN** [**ACCESSTOKEN**]; searching
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/6v6k2g45hrxazgbbw3zyv6pl8914**ACCESSTOKEN**v1y-libXxf86vm-1.1.5/lib/libxcb-glx.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/lsp7hk1ppjv4**ACCESSTOKEN**3q8h191p929wycbk**ACCESSTOKEN**r3-systemd-minimal-libs-255.4/lib/libxcb-glx.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/msi95r4426zlfbmzr1a9v45b2vgqaail-discord-rpc-3.4.**ACCESSTOKEN**/lib/libxcb-glx.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/nix/store/4ja9a94kxjqwm65c5bpnrnsa5rffb**ACCESSTOKEN**ij-glfw-3.4/lib/libxcb-glx.so.**ACCESSTOKEN**
[15/05/2024 17:57:17 PM] 1553887: trying file=/lib64/libxcb-glx.so.**ACCESSTOKEN**
[15/05/2024 17:57:25 PM] 1553887: calling fini: /lib64/libGLX.so.**ACCESSTOKEN** [**ACCESSTOKEN**]
[15/05/2024 17:57:25 PM] 1553887: calling fini: /lib64/libGLX_mesa.so.**ACCESSTOKEN** [**ACCESSTOKEN**]
[15/05/2024 17:57:25 PM] 1553887: calling fini: /lib64/libxcb-glx.so.**ACCESSTOKEN** [**ACCESSTOKEN**]
I’m actually using 3.4.28.1
since I don’t a Microsoft account and I needed to open the game offline. I thought newer versions of the launcher might have the same problem since it didn’t work for @noofel.rouge either. Could this be because I’m running an older version?
Edit: I’ve added libglvnd
to the wrapper and now the game works even without steam-run
…
Okay, that’s good. Was the error occurring when launching the launcher itself or an instance?
It was happening when I launched an instance.
Weird, I’m unable to get an instance running even with 3.4.28.1
. I can’t even figure out any more libraries that it needs since the actual Minecraft instances need these libs, and not the launcher. steam-run atlauncher
works with all versions.
This is how I’m currently overriding the package:
environment.systemPackages = with pkgs; [
(atlauncher.overrideAttrs rec {
pname = "atlauncher";
version = "3.4.28.1";
src = fetchurl {
url = "https://github.com/ATLauncher/ATLauncher/releases/download/v${version}/ATLauncher-${version}.jar";
hash = "sha256-IIwDMazxUMQ7nGQk/4VEZicgCmCR4oR8UYtO36pCEq4=";
};
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share/java
cp $src $out/share/java/ATLauncher.jar
makeWrapper ${jre}/bin/java $out/bin/${pname} \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ xorg.libXxf86vm udev discord-rpc libglvnd ]}" \
--add-flags "-jar $out/share/java/ATLauncher.jar" \
--add-flags "--working-dir \"\''${XDG_DATA_HOME:-\$HOME/.local/share}/ATLauncher\"" \
--add-flags "--no-launcher-update"
mkdir -p $out/share/icons/hicolor/scalable/apps
cp $ICON $out/share/icons/hicolor/scalable/apps/${pname}.svg
runHook postInstall
'';
})
];
Without steam-run
, the instance I’m running is the vanilla Minecraft 1.20.6 with the following instance settings:
- General
- Account Override → Default
- Enable Discord Integration? → No
- Java/Minecraft
- Didn’t touch the Java parameters (openjdk-21+35)
- Use Java Provided By Minecraft? → No
- Disable Legacy Launching? → Default
- Use System GLFW? → No
- Use System OpenAL? → No
- Commands → No
I should also note that I have no sound when not running with steam-run
, but that’s another issue, I guess.
It looks like what you’ve overridden is the same as what I’ve done.
Some differences I can note at first glance are:
- I’m not putting ATLauncher in my system, rather in my home.
- I’m using a custom HM module for ATLauncher but it doesn’t exactly add anything too different.
- Sound works for me.
Just to confirm, you’re on X11, right?
All right so I ditched my custom HM module and copy pasted what you sent, this time I’ve gotten logs which were not there before for whatever reason:
[16/05/2024 00:36:20 am] Could not start dynamically linked executable: **USERSDIR**/runtimes/minecraft/java-runtime-delta/linux/java-runtime-delta/bin/java
[16/05/2024 00:36:20 am] NixOS cannot run dynamically linked executables intended for generic
[16/05/2024 00:36:20 am] linux environments out of the box. For more information, see:
[16/05/2024 00:36:20 am] https://nix.dev/permalink/stub-ld
[16/05/2024 00:36:20 am] Oh no. Minecraft crashed. Please check the logs for any errors and provide these logs when asking for support.
Given that ATLauncher isn’t working even on older versions which were confirmed to be working on NixOS, I suspect that updates to its dependencies have caused it to fail.
Yup.
This means that ATlauncher is trying to load its java runtime, which won’t work. Just choose the jre from the nix store in your settings:
That worked for me. Though I’m worried that anyone using this package would run into this issue and may not always know the fix for it. But there’s no real way to solve this declaratively without using NixOS modules AFAIK.
Perhaps it’s possible to patch out the logic that downloads the jre in the first place, but what we can currently do is add this information to the Wiki, at least.