hi! I’m fairly new to nixos, and had a wonderful, seamless experience. for a month. upon updating to nixos 23.11 (I now use unstable, which also does not work), running Minecraft from an IDE to develop mods no longer works, failing with an OpenGL exception:
[LWJGL] Platform/architecture mismatch detected for module: org.lwjgl.opengl
JVM platform: Linux amd64 21
OpenJDK 64-Bit Server VM v21+35-nixos by Oracle Corporation
Platform available on classpath:
linux/x64
Minecraft loads fine from Prism Launcher, however this error makes it impossible for me to work on my mods.
My nix config:
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
<home-manager/nixos>
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# bluetooth
hardware.bluetooth.enable = true;
# docker
virtualisation.docker.enable = true;
virtualisation.podman.enable = true;
# Set your time zone.
time.timeZone = "America/Winnipeg";
# Select internationalisation properties.
i18n.defaultLocale = "en_CA.UTF-8";
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
nixpkgs.config.allowUnfree = true;
# Configure keymap in X11
services.xserver = {
layout = "us";
xkbVariant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
services.printing.drivers = [
pkgs.brlaser
];
# remove the world's worst program
environment.plasma5.excludePackages = with pkgs.libsForQt5; [
okular
];
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.lily = {
isNormalUser = true;
description = "lily";
extraGroups = [
"networkmanager"
"wheel"
"docker"
"cdrom"
];
packages = with pkgs; [
firefox
speechd
kate
jetbrains.idea-ultimate
prismlauncher
steam
wine
lutris
vlc
krita
obsidian
inkscape
darktable
asunder
libsForQt5.filelight
libsForQt5.k3b
blockbench-electron
blender
spotify
libreoffice
audacity
];
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
wget
gnupg
brlaser
gradle
home-manager
deno
nodePackages.pnpm
git
libvirt
qemu
podman
libsForQt5.kdialog
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "gnome3";
enableSSHSupport = true;
};
programs.zsh.enable = true;
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
};
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
home-manager.users.lily = { pkgs, ... }: {
home.packages = [ pkgs.atool pkgs.httpie ];
programs.bash.enable = true;
programs.git = {
enable = true;
userName = "ix0rai";
userEmail = "ix0rai@gmail.com";
};
# The state version is required and should stay at the version you
# originally installed.
home.stateVersion = "23.05";
};
nixpkgs.config.permittedInsecurePackages = [
"electron-24.8.6"
"electron-22.3.27"
"electron-25.9.0"
];
}
---- Minecraft Crash Report ----
// My bad.
Time: 2023-12-30 12:20:40
Description: Initializing game
java.lang.UnsatisfiedLinkError: Failed to locate library: libGL.so.1
at org.lwjgl.system.Library.loadNative(Library.java:346)
at org.lwjgl.system.Library.loadNative(Library.java:435)
at org.lwjgl.system.Library.loadNative(Library.java:402)
at org.lwjgl.opengl.GL.create(GL.java:101)
at org.lwjgl.opengl.GL.<clinit>(GL.java:85)
at com.mojang.blaze3d.platform.GLX._initGlfw(GLX.java:64)
at com.mojang.blaze3d.systems.RenderSystem.initBackendSystem(RenderSystem.java:847)
at net.minecraft.client.MinecraftClient.<init>(MinecraftClient.java:491)
at net.minecraft.client.main.Main.main(Main.java:214)
at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468)
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Thread: Render thread
Stacktrace:
at org.lwjgl.system.Library.loadNative(Library.java:346)
at org.lwjgl.system.Library.loadNative(Library.java:435)
at org.lwjgl.system.Library.loadNative(Library.java:402)
at org.lwjgl.opengl.GL.create(GL.java:101)
at org.lwjgl.opengl.GL.<clinit>(GL.java:85)
at com.mojang.blaze3d.platform.GLX._initGlfw(GLX.java:64)
at com.mojang.blaze3d.systems.RenderSystem.initBackendSystem(RenderSystem.java:847)
at net.minecraft.client.MinecraftClient.<init>(MinecraftClient.java:491)
-- Initialization --
Details:
Modules:
Stacktrace:
at net.minecraft.client.main.Main.main(Main.java:214)
at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468)
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
-- System Details --
Details:
Minecraft Version: 1.20.2
Minecraft Version ID: 1.20.2
Operating System: Linux (amd64) version 6.1.69
Java Version: 21, N/A
Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Oracle Corporation
Memory: 34788648 bytes (33 MiB) / 377487360 bytes (360 MiB) up to 4181721088 bytes (3988 MiB)
CPUs: 16
Processor Vendor: AuthenticAMD
Processor Name: AMD Ryzen 7 2700X Eight-Core Processor
Identifier: AuthenticAMD Family 23 Model 8 Stepping 2
Microarchitecture: Zen+
Frequency (GHz): -0.00
Number of physical packages: 1
Number of physical CPUs: 8
Number of logical CPUs: 16
Graphics card #0 name: unknown
Graphics card #0 vendor: unknown
Graphics card #0 VRAM (MB): 0.00
Graphics card #0 deviceId: unknown
Graphics card #0 versionInfo: unknown
Virtual memory max (MB): 25524.77
Virtual memory used (MB): 13961.75
Swap memory total (MB): 17548.85
Swap memory used (MB): 3318.75
JVM Flags: 0 total;
JVM uptime in seconds: 9.727
Launched Version: Fabric
Backend library: LWJGL version 3.3.2-snapshot
Backend API: Unknown
Window size: <not initialized>
GL Caps: Using framebuffer using OpenGL 3.2
GL debug messages: <disabled>
Using VBOs: Yes
Is Modded: Definitely; Client brand changed to 'fabric'
Type: Client (map_client.txt)
Locale: en_CA
CPU: <unknown>
#@!@# Game crashed! Crash report saved to: #@!@# /home/lily/dev/rainglow/run/crash-reports/crash-2023-12-30_12.20.40-client.txt
> Task :runClient FAILED
That is definitely useful. Someone with more java exp may be able to say more.
Next thing I would want to know is where the java lib is looking for libGL.so. strace is a good way of doing this. Once you can see that, it should give you a fairly good idea why java can’t find the openGL lib
$ nix-locate --top-level libGL.so
xorg_sys_opengl.out 0 s /nix/store/5iwk3yqvkbxkmibphv5hkvgad1imr7d8-xorg-sys-opengl-3/lib/libGL.so.1
qt6.full.out 0 s /nix/store/0800mlxnhc2br7h0123dz92i6w873nnp-qt-full-6.6.1/lib/libGL.so
qt6.full.out 0 s /nix/store/0800mlxnhc2br7h0123dz92i6w873nnp-qt-full-6.6.1/lib/libGL.so.1
qt6.full.out 0 s /nix/store/0800mlxnhc2br7h0123dz92i6w873nnp-qt-full-6.6.1/lib/libGL.so.1.7.0
primusLib.out 0 s /nix/store/dy5yiw2r3lj9k8syfbwy8cwslk4hlamz-primus-lib-unstable-2015-04-28/lib/libGL.so
primusLib.out 390,192 x /nix/store/dy5yiw2r3lj9k8syfbwy8cwslk4hlamz-primus-lib-unstable-2015-04-28/lib/libGL.so.1
libglvnd.out 0 s /nix/store/yw48bqgswppkcrx303ybgbn6r2nqbda1-libglvnd-1.7.0/lib/libGL.so
libglvnd.out 0 s /nix/store/yw48bqgswppkcrx303ybgbn6r2nqbda1-libglvnd-1.7.0/lib/libGL.so.1
libglvnd.out 740,448 x /nix/store/yw48bqgswppkcrx303ybgbn6r2nqbda1-libglvnd-1.7.0/lib/libGL.so.1.7.0
running Minecraft from an IDE to develop mods no longer works, failing with an OpenGL exception:
To make this library available, you can use LD_LIBRARY_PATH which can extend the default locations for glibc to look for dynamic libraries. To do this, you want to run something like export LD_LIBRARYPATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}/nix/store/yw48bqgswppkcrx303ybgbn6r2nqbda1-libglvnd-1.7.0/lib
Ideally, this would take the form of using nix develop:
if you’re running the steps within the IDE, then a lot of those will create new shells which don’t inherit shell variables. So LD_LIBRARY_PATH isn’t being communicated. Not sure of your IDE setup, but they generally allow you to extend the shell variables.
i had this same issue, i managed to get it working system-wide. im new to nixos so this probably isnt the right way but it seems to work just fine with intellij idea.
like jonringer said you can edit the LD_LIBRARY_PATH in your ide, which i did until i found one that worked, for me it was /nix/store/jz3vvf4nsyirb25rh9dbhksm4gq6wybb-libglvnd-1.7.0/lib/:/nix/store/pn9glkalcj7i5p549dpsl1c46pkb13xr-pulseaudio-17.0/lib/
which is the libglvnd for libGL.so.1 and also i had to add the pulseaudio one for openAL because it was missing that too somehow.
and then to make that global i just added it to my configuration.nix by adding this:
I am so sorry to necropost but I am having a similar issue and its driving me insane.
My problem is more with GLFW. I am trying to run a minecraft dev enviorment for a mod and it will not run the client.
This is the constant error:
Failure details:
We are unable to initialize the graphics system.
glfwInit failed.
Exception in thread "main" java.lang.IllegalStateException: Unable to initialize GLFW
at MC-BOOTSTRAP/fmlearlydisplay@1.20.1-47.3.0/net.minecraftforge.fml.earlydisplay.DisplayWindow.initWindow(DisplayWindow.java:351)
at MC-BOOTSTRAP/fmlearlydisplay@1.20.1-47.3.0/net.minecraftforge.fml.earlydisplay.DisplayWindow.start(DisplayWindow.java:294)
at MC-BOOTSTRAP/fmlearlydisplay@1.20.1-47.3.0/net.minecraftforge.fml.earlydisplay.DisplayWindow.initialize(DisplayWindow.java:157)
at MC-BOOTSTRAP/fmlloader@1.20.1-47.3.0/net.minecraftforge.fml.loading.ImmediateWindowHandler.load(ImmediateWindowHandler.java:48)
at MC-BOOTSTRAP/fmlloader@1.20.1-47.3.0/net.minecraftforge.fml.loading.ModDirTransformerDiscoverer.earlyInitialization(ModDirTransformerDiscoverer.java:43)
at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServicesHandler.lambda$discoverServices$18(TransformationServicesHandler.java:131)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.TransformationServicesHandler.discoverServices(TransformationServicesHandler.java:131)
at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.run(Launcher.java:87)
at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.Launcher.main(Launcher.java:78)
at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.9/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
at cpw.mods.bootstraplauncher@1.1.2/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)
This is apparently an issue normally fixed with adding the JVM arg -Dfml.earlyprogresswindow=false due to wayland issues, but that’s not the case here. Ive tried the solutions given here, but since its not exactly the same issue they did not help. Does anyone have any idea what I can try?
Currently i have these in my nix config hopping they might help but I am now out of my depth.