diff --git a/README.md b/README.md index 477d4ab..fa36939 100644 --- a/README.md +++ b/README.md @@ -98,11 +98,26 @@ paru -S rmcl-git ### Nix +[![Nix](https://img.shields.io/badge/nix-5277C4?style=for-the-badge&logo=nixos)](https://github.com/objz/rmcl) + ```sh nix run github:objz/rmcl nix profile install github:objz/rmcl ``` +the flake builds rmcl from source. as with other source builds, CurseForge +support is only enabled when `CURSEFORGE_API_KEY` is provided at build time: + +```sh +CURSEFORGE_API_KEY=your-key nix build --impure .# +``` + +without a key, Modrinth works and CurseForge is disabled. prebuilt release +binaries ship with the key baked in. + +Minecraft 1.12 and older currently fail to launch because rmcl doesn't pass +`-Djava.library.path` for legacy version profiles. + ### Cargo [![crates.io](https://img.shields.io/crates/v/rmcl?style=for-the-badge&logo=rust)](https://crates.io/crates/rmcl) diff --git a/flake.nix b/flake.nix index 553f217..1f8de68 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,9 @@ }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; + # release binaries have the curseforge key compiled in; source builds + # don't, so forward the caller's key when building impurely. + curseforgeApiKey = builtins.getEnv "CURSEFORGE_API_KEY"; # 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. @@ -32,6 +35,10 @@ nativeBuildInputs = [pkgs.jdk pkgs.makeWrapper]; buildInputs = [pkgs.libxcb]; + env = pkgs.lib.optionalAttrs (curseforgeApiKey != "") { + CURSEFORGE_API_KEY = curseforgeApiKey; + }; + postFixup = '' wrapProgram $out/bin/rmcl --prefix LD_LIBRARY_PATH : ${runtimeLibs} '';