Change:
sourceProvenance = with sourceTypes; [ binaryNativeCode ]; license = licenses.unfree; platforms = [ "x86_64-linux" ]; <ins> # "minecraft-launcher will fail on NixOS for minecraft versions >1.19 # try prismlauncher or atlauncher instead" broken = true; </ins> }; passthru = {

Discussion:
I used to play Minecraft on NixOS just fine, but ever since the game switched from Mojang IDs to Microsoft IDs, the Linux client no longer works. If I attempt to log in with Mojang, the software says that I am not online, which means that the server it's trying to talk to has disappeared I guess. If I attempt to log in with the Microsoft ID, it does work initially, but then the game won't start saying it experienced an unexpected crash. !
This is happening on recent versions of , like .
I am experiencing the same problem. I can aditionally provide some logs:
might be related to the launcher, because it was not updated since 2021-01-27
I've experienced the same, and I believe it might be a launcher issue as well. From what I understand, the Minecraft launcher is responsible for pre-fetching Java libraries (which makes sense, given the error message posted by ). Unfortunately, it looks like the version of the launcher within the derivation is the most recent that can be fetched with a reproducible build. In is a link to the Minecraft wiki pages listing all launcher versions, with the most recent as of writing being . For some odd reason, it looks like is valid but 404's. The actual for Linux just uses the URL to download the most recent version. This unfortunately doesn't have a version tag, so it's not possible to reproduce builds with that download link. When the client is run, there's a popup about updating the client with a clickable link (see img) ! could be useful if it manually downloads the libraries instead. Unfortunately, when I click the link I see the following error in the logs: So, it looks like a patch might be necessary regardless. I've tried ing through the launcher archives and binaries but I've yet to find where/how is being called. Not sure where to go from there.
In the past it looks like we've referred to Flatpak for how they download the launcher: I was looking at Flatpak again and in they switch to a different version train (?) of the launcher.

I'm not totally sure what launcher this is, but it coincides with the entry in the launcher metadata: I'm able to actually download an archive by updating with the following: However, once I do so I'm running into issues with , specifically:
I think this might just be the launcher bootstrapper (which would download the launcher), so probably not what we want, since it won't be reproducible.
Still no luck trying to figure out the download for . I ended up booting up Ubuntu in a VM and running the Minecraft launcher bootstrapper while sniffing the traffic with Wireshark to see what it's pulling. I'm still sorting through the packets, but I did find this URL that looked interesting: If you download it you get an LZMA compressed file:
I downloaded version 2.2.1441 of the Minecraft launcher on my Ubuntu VM and clicked the link in the popup. It takes you to which then redirects to to download Minecraft.
One thing I did notice during this process is that the contents of the archive file downloaded from : Are very similar to the contents of the manifest for 's : I suspect downloading each of these files from the manifest and putting them into a directory would be the equivalent of downloading and extracting a tar archive for the launcher version (albeit more annoying to do).
I'm still trying to piece together what the different launcher versions are, but here's the relevant entries from The version listed under , 2.3.280, is aligned with the most recent launcher version listed : !
For anyone else who's stuck on this and just wants to play Minecraft (as opposed to fixing the broken package), I switched to PolyMC and it works with no issues.
I only have this problem when launching 1.19. Earlier versions work fine. nixos-22.05
I have this problem too
I wrote a script to download the launcher and assemble the . It successfully starts the new launcher, it doesn't pop up a "game crashed" error, but it fails to launch an the opengl window w/mojang logo. Commits are here: To reproduce, you run inside a local checkout of nixpkgs and then install minecraft from the local checkout of nixpkgs. That said, this doesn't succeed in launching the game, it just gets past the LWJGL/Game Crashed! bug.

Maybe we should at least ask Mojang if the new versions are available at another URL and if not, if they could restore that feature?
I was able to get the new minecraft client to run. These are the steps I took: the bootstrapper from up the files in them as a replacement for the archive in the file. nix-build with my modified [1] Here, I tried to run the wrapper script, yet the started application tried to update the game, because of the following: "Current executable is not in game directory, update and run game directory version". My workaround was to copy the files in to the directory and wrap the executable there, as follows: (this is needed every time I run the game — else it tries to update the client again) to wrap in e.g. in to mojang/microsoft account the game profile to change the java version to (from the game I'm aware that this is a somewhat hacky solution, yet as I'm unexperienced in nix packaging, I hope someone else can take the info and update the package accordingly. Would be much appreciated :) 1:
To anyone else who has followed the above advice, beware the following (got this when updating): see more on
Having the same problem here with the official launcher
Has there been any updates on this issue? I got here after facing the same issue on .
I don't think so, but I am actually using PrismLauncher with any problems
RIP, I hoped I could stick to the official launcher.
I think you should be able to download the official and run it using openjdk. It's not ideal but it may work if you really want to stick to the official launcher
Nah, I'd rather have simple setup than sticking to the official. Thanks anyways.
This is a good choice, that i could not make, unfortunateally (for accounts of age <18, you cannot use 3rd party launchers) For anyone who does want to go down this path, here are the steps (because oh my god did this suck to figure out). : required, not on NixOS by default (this and flite might not work if installed using !) : might not be required (dependency of narrator) : required, can use : required, can use (build process only!)

Download (use the button) extract the downloaded now, enter a FHS env bash shell using (this emulates the normal linux directories that the launcher expects to be there, like /bin/). at this point all dependencies (except ) must be installed! once there, run the executable, making sure to first set the env var (see below) (may have to ) Now, to launch the launcher you can run the following command (with /) You are now done! (but not if you use fabric (mod loader), or an nvidia optimus laptop...) This is where is needed. First, copy the following rust code to a file named and compile it with (this will create some build artifacts that can be removed) Then, place the produced executable somewhere :shrug: and edit your minecraft profile in the launcher to use a custom java executable, that being the program that you just created. (this also works with modded version) WRONG. Attempting to use a bash script to replicate the function of the rust program will not work. If you do try this, or like me tried it thinking it was the correct way, minecraft will launch, and it will use the dedicated GPU, however fabric, and any mods for it will not be loaded AT ALL. no error messages, no logs, nothing. This is not a great way of doing things (having to run multiple commands in the shell every time you want to start the launcher is the big reason, though i might try and improve this in the future), and if anyone wants to upstream a better version of this that would be great Also, if the current package is this broken, it seems like a good idea to add some sort of warning to it so that people know not to use it?
This seems odd, any idea why? What about launching via something like switcherooctl?
absolutely no idea. the issue with something like is that you would need a bash script or other program to launch it anyway, since the minecraft launch command must be only an executable, no shell arguments or anything (which i assume would cause the same issue, although i have not checked this). notes: I'm assuming that something that bash does / running an interpreted script must somehow affect how minecraft runs (no clue why).

this still does not explain how the failure mode of this is to launch vanilla minecraft instead of just crashing like a normal program it appears that using is not necessary (in the env var setting script), also works fine
Thanks for the detailed walk-through, Can you test if this package works on other platforms? If it does, then it's probably just broken on Linux; Depending on this, either or attribute can be set.
You're welcome! I'm not set up to test on anything other than my current system unfortunateally (which if it matters is NixOS 23.11 unstable, nvidia optimus laptop with an AMD Ryzen 7 cpu and NVIDIA 1650 Ti Mobile) (also this might actually be a NixOS spacific problem?) I think the package probably should be marked out of date (or equivilant) untill the version of the launcher in the package can be updated to the latest version, since in its current state it just crashes when launching the game. (also to me it looks like the only blocking issue here is the requirement of nixpkgs to have reliable builds, and not any technical issue (can someone clarify?)) The information/problems listed here will mostly be usefull after the version is updated, or for people doing it manually, and i think is the lesser problem here, since it only applies to using nvidia optimus with modded minecraft spacifically (either of the two on their own, or vanilla works just fine) If anyone would like to do more detailed testing and needs more details from me, or if anyone is trying to do the fix and it is failing, please ask me!
I'll try an updated version of this on my local system, if it works I'll send a PR to update the same. (I doubt the fix would be as easy as this as is evident from earlier comments in this issue). Besides, there are 2 things you can mark in a package for this scenario: . Untrue, to the best of my knowledge; the requirement also includes basic functionality of the build working correctly (as is evident from .
Sorry, I had meant that the reason no one had fixed the problem of the launcher crashing [because of an outdated launcher] was that mojang does not offer a way to download specific versions of the more recent launcher builds.

(unless this was not what you meant, in which case ignore what i just said) Either way, thank you for looking into this more on the nixpkgs side of things
I'm new to Nix(OS), but I was wondering, has anybody tried simply writing a configuration snippet that loads an Ubuntu or Arch container in the background and simply runs Minecraft Launcher from there?
I got this: prismlauncher works perfectly for me though! Thanx for the suggestion!
Alr so i turned on logs for Java Edition and Here are The Results: Vanilla: Fabric: not sure if this helps but i thought it was a good idea yo put this in
Alr i found a solution for myself, use See if this helps
Hey, Could you please look into this thread and potentially add a broken tag to this package until it's fixed? (if it applies)
Someone pinged me asking for help with this, and I got curious about the actual root cause. Seems nobody has figured it out yet, so I went sleuthing. As far as I can tell, the issue is a change in lwjgl, or how it is used. From what I can tell, prior to version 1.19 of the game, the Minecraft launcher would start it with lwjgl 3.2.2. It lists these lwjgl-related libraries in the classpath: lwjgl- lwjgl-jemalloc- lwjgl-openal- lwjgl-opengl- lwjgl-glfw- lwjgl-stb- lwjgl-tinyfd- None of them contain an , only checksums that refer to such a library. 1.18 and earlier will launch just fine, irrespective of whether the launcher was updated or not.

Since Minecraft version 1.19, it instead has all these libraries: lwjgl-glfw- lwjgl-glfw-3.3.1:natives- lwjgl-jemalloc- lwjgl-jemalloc-3.3.1:natives- lwjgl-openal- lwjgl-openal-3.3.1:natives- lwjgl-opengl- lwjgl-opengl-3.3.1:natives- lwjgl-stb- lwjgl-stb-3.3.1:natives- lwjgl-tinyfd- lwjgl-tinyfd-3.3.1:natives- lwjgl- lwjgl-3.3.1:natives- The part may already look concerning to anyone familiar with the pains of using precompiled native things on NixOS, and indeed, there is an hidden in . From some sleuthing, it looks like lwjgl has always had the option of using native components. It just looks like Microsoft recently flipped over to actually using them. Previously it was instead using the pure java implementation, which naturally had no issues with NixOS. The good news is that PrismLaucher also uses lwjgl-3.3.1, and it also uses the native components as far as I can tell, but works in spite of this, so there's no issue with loading the shared library. This means it can probably be fixed without having to do something horrible like patching things at runtime. The difference is that, since PrismLauncher is compiled natively instead of being a repackaged binary package, it does not modify . My guess is that messes with whatever magic lwjgl/java uses to load its native components from a specific path, and as a result the shared library cannot be found when using the nix package. Hence, the nix package is broken (for Minecraft versions 1.19 and up). I think it should be marked as such, I'll send up a PR. I'm unsure why the previously detailed workarounds work. My guess is that somewhere hidden in them there is an env clear that applies only to the launched java instance that gets rid of the packages' .
Hm, scratch that, I'm not sure.

The package still partially works, it's just broken for any Minecraft version younger than 1.19. Is this sufficiently broken to mark it broken?
thanks for your work in debugging this. I was recently setting up machines for young people to play Minecraft, and encountered the joys of the official launcher crashing. I'd say so. This has been ongoing for ~18 months, give or take (in addition to however long it was occurring prior to this issue being opened). It was a fairly frustrating experience, and I found this issue only after I had decided to use . I'm happy enough with the decision, but it still seems like we need to either figure out how to fix this, or remove the package.
Also just helped people with this... ran into the same problem regarding new versions failing in a way hard for people to debug themselves. I'm leaning toward marking the minecraft client as broken. (if people explicitly need old versions, they likely need a launcher anyway, or can figure out how to un-broken it). Or at least a warning.