From 3525c7b69c8236a7c33ae29a3671518c5f7a9a6f Mon Sep 17 00:00:00 2001 From: GitanElyon Date: Mon, 28 Sep 2026 23:57:52 -0400 Subject: [PATCH] fix(nix): expose x11 libs to the launched game minecraft's bundled lwjgl natives dlopen the host's x11 stack, which isn't on the default loader path on nixos. wrap rmcl with an LD_LIBRARY_PATH so the java process it spawns can load them. --- flake.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index a65b8fd..553f217 100644 --- a/flake.nix +++ b/flake.nix @@ -13,15 +13,29 @@ }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; + # minecraft's bundled lwjgl natives dlopen the host's x11 stack, which + # isn't on the default loader path on nixos. java is spawned as a child + # of rmcl, so a wrapper LD_LIBRARY_PATH propagates all the way down. + runtimeLibs = pkgs.lib.makeLibraryPath (with pkgs; [ + libX11 + libXext + libXcursor + libXrandr + libXxf86vm + ]); in { packages.default = pkgs.rustPlatform.buildRustPackage { pname = "rmcl"; version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version; src = pkgs.lib.cleanSource ./.; cargoLock.lockFile = ./Cargo.lock; - nativeBuildInputs = [pkgs.jdk]; + nativeBuildInputs = [pkgs.jdk pkgs.makeWrapper]; buildInputs = [pkgs.libxcb]; + postFixup = '' + wrapProgram $out/bin/rmcl --prefix LD_LIBRARY_PATH : ${runtimeLibs} + ''; + meta = with pkgs.lib; { description = "A fully featured Minecraft TUI launcher"; homepage = "https://github.com/objz/rmcl";