feat(nix): curseforge key env support

gave flake support for adding own CURSEFORGE_API_KEY at build time; updated README.md with new details
This commit is contained in:
GitanElyon committed 2026-09-29 12:08:53 -04:00
1 parent 3525c7b69c
commit 04c92f17bf
2 files changed
+22

No files matched your search

+15
View File
@@ -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)
+7
View File
@@ -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}
'';