[PR #3189] [MERGED] Launcher: build native mods on the Nightly they pin, with its own Rust #4838

Closed
opened 2026-11-03 05:08:18 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3189
Author: @ludovic111
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-native-build


📝 Commits (2)

  • 7f3bd90 Launcher: build native mods on the Nightly they pin, with its own Rust
  • 727f6c9 docs/native-mods.md: the measured build times and sizes

📊 Changes

7 files changed (+859 additions, -3 deletions)

View changed files

📝 docs/launcher-commands.md (+11 -0)
➕ docs/native-mods.md (+94 -0)
📝 launcher/src/backend.rs (+2 -2)
📝 launcher/src/cli.rs (+32 -0)
📝 launcher/src/cli_tools.rs (+3 -1)
📝 launcher/src/lib.rs (+1 -0)
➕ launcher/src/native_mods.rs (+716 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

On top of #3179 (the launcher's portable Rust, merged). It builds native mods, levzzz5154's horizon-mixins bundles, into a game of their own, on the Nightly they pin. That covers levzzz's 10-28 request: "loading native mods works in the launcher, mod versions should be pinned to nightly ones".

It takes over native-mixins-1's unmerged work from 10-27, with three changes:

  • it uses the launcher's own Rust (#3179) instead of the player's rustup;
  • it builds on the commit the mods pin, not on a release tag;
  • it reads registry .hnmod bundles (#3140's format).

What it does

horizon-launcher native-build FOLDER --trust-native-code. FOLDER is a bundle, an unpacked .hnmod or a folder of them. The command is kept out of MCP: trusting native code is the player's decision. The steps:

  1. Revision. Every mod pins a Horizon commit ([compatibility] horizon_revision, or horizon in horizon-native.json), and all mods of one build must agree. When they don't, the error lists which mod pins which commit. A bundle with no pin builds on the commit of the starting installed version: GitHub resolves the release tag, or the Nightly's short commit.
  2. Rust. rust_toolchain::install, plus the linker check.
  3. horizon-mixins at the commit the .hnmod names, or MIXINS_REV (0500ff2 on horizon-rust/horizon-mixins). It is built once with that cargo.
  4. Source from GitHub's archive by commit. A Nightly's commit stays available through its nightly-source/ tag (#3174).
  5. Apply and compile. horizon-mixins apply, then sync only the changed files into the stage, then the release's own cargo build --locked --profile release --features horizon-client/mods -p horizon-client.
  6. Install. A native-<commit7>-<key> version: a copy of the starting version with the built game in it, plus native-mods.json recording the commit, mods, horizon-mixins and Rust. The Native mods instance plays it. The key hashes everything that matters, so the same set never builds twice.

docs/native-mods.md describes all of it: pinning, the steps, cache and disk, trust, multiplayer, and what's left.

Proof (Mac mini, isolated HORIZON_HOME, HORIZON_LAUNCHER_HOME, XDG_*, HORIZON_LAUNCHER_NO_SELF_UPDATE=1, HORIZON_NO_AUDIO=1, HORIZON_LAUNCHER_TRASH, HORIZON_LAUNCHER_CLIPBOARD)

  • Veinminer 0.3.0: levzzz's .hnmod from the registry's staging release, SHA-256 ec308c02…, pinned to nightly 83f15fa. Built with native-build on base v0.2.93 (installed; resources seeded from shared-local, nothing from Mojang):

    • native-83f15fa-4bbdb580b9ca in 580 s cold, of which 9 min 10 s was compiling;
    • the toolchain used was only the launcher's own (see the build log's first command);
    • native/target is 1.5 GB.
  • Played it: horizon-ctl launch --offscreen on the built version, Metal. /veinminer status answered Veinminer: on; /veinminer off answered Veinminer: off. The screenshot shows both chat lines in the modded game.

  • Warm rebuild after a code change in a helper: 2 min 46 s of compiling, horizon-client only. A comment-only change compiles nothing (31 s). The older native build was pruned.

  • Tests:

    • a registry download is a bundle with its pins;
    • the mods of one build pin one revision, and the error names them;
    • the key changes with the revision, the horizon-mixins commit and any file;
    • only changed files are written to the stage;
    • diagnostics read in one line.

    launcher clippy -D warnings and the launcher tests pass. The CLI reference is regenerated.

Size: about 860 lines with tests (~230) and docs (~110). It is one module, so I didn't split it further.

Needs Ludovic / levzzz

  • Windows and Linux: the toolchains are pinned in #3179, but a full game build on them is unproven here (Mac mini only).
  • The window's switch, Mods page and progress screen come in the next PR, which also installs registry entries. This one is CLI only.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3189 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-native-build` --- ### 📝 Commits (2) - [`7f3bd90`](https://github.com/horizon-rust/horizon/commit/7f3bd901bc4e3747f8f293e78f7ffa7597f75ae1) Launcher: build native mods on the Nightly they pin, with its own Rust - [`727f6c9`](https://github.com/horizon-rust/horizon/commit/727f6c932acf0763ceeea285f4155609224a3542) docs/native-mods.md: the measured build times and sizes ### 📊 Changes **7 files changed** (+859 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/launcher-commands.md` (+11 -0) ➕ `docs/native-mods.md` (+94 -0) 📝 `launcher/src/backend.rs` (+2 -2) 📝 `launcher/src/cli.rs` (+32 -0) 📝 `launcher/src/cli_tools.rs` (+3 -1) 📝 `launcher/src/lib.rs` (+1 -0) ➕ `launcher/src/native_mods.rs` (+716 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. On top of #3179 (the launcher's portable Rust, merged). It builds native mods, levzzz5154's horizon-mixins bundles, into a game of their own, on the Nightly they pin. That covers levzzz's 10-28 request: "loading native mods works in the launcher, mod versions should be pinned to nightly ones". It takes over native-mixins-1's unmerged work from 10-27, with three changes: - it uses the launcher's own Rust (#3179) instead of the player's rustup; - it builds on the commit the mods pin, not on a release tag; - it reads registry `.hnmod` bundles (#3140's format). ## What it does `horizon-launcher native-build FOLDER --trust-native-code`. FOLDER is a bundle, an unpacked `.hnmod` or a folder of them. The command is kept out of MCP: trusting native code is the player's decision. The steps: 1. **Revision.** Every mod pins a Horizon commit (`[compatibility] horizon_revision`, or `horizon` in `horizon-native.json`), and all mods of one build must agree. When they don't, the error lists which mod pins which commit. A bundle with no pin builds on the commit of the starting installed version: GitHub resolves the release tag, or the Nightly's short commit. 2. **Rust.** `rust_toolchain::install`, plus the linker check. 3. **horizon-mixins** at the commit the `.hnmod` names, or `MIXINS_REV` (0500ff2 on horizon-rust/horizon-mixins). It is built once with that cargo. 4. **Source** from GitHub's archive by commit. A Nightly's commit stays available through its `nightly-source/` tag (#3174). 5. **Apply and compile.** `horizon-mixins apply`, then sync only the changed files into the stage, then the release's own `cargo build --locked --profile release --features horizon-client/mods -p horizon-client`. 6. **Install.** A `native-<commit7>-<key>` version: a copy of the starting version with the built game in it, plus `native-mods.json` recording the commit, mods, horizon-mixins and Rust. The **Native mods** instance plays it. The key hashes everything that matters, so the same set never builds twice. docs/native-mods.md describes all of it: pinning, the steps, cache and disk, trust, multiplayer, and what's left. ## Proof (Mac mini, isolated `HORIZON_HOME`, `HORIZON_LAUNCHER_HOME`, `XDG_*`, `HORIZON_LAUNCHER_NO_SELF_UPDATE=1`, `HORIZON_NO_AUDIO=1`, `HORIZON_LAUNCHER_TRASH`, `HORIZON_LAUNCHER_CLIPBOARD`) - **Veinminer 0.3.0**: levzzz's `.hnmod` from the registry's staging release, SHA-256 `ec308c02…`, pinned to nightly `83f15fa`. Built with `native-build` on base v0.2.93 (installed; resources seeded from shared-local, nothing from Mojang): - `native-83f15fa-4bbdb580b9ca` in 580 s cold, of which 9 min 10 s was compiling; - the toolchain used was only the launcher's own (see the build log's first command); - `native/target` is 1.5 GB. - **Played it**: `horizon-ctl launch --offscreen` on the built version, Metal. `/veinminer status` answered `Veinminer: on`; `/veinminer off` answered `Veinminer: off`. The screenshot shows both chat lines in the modded game. - **Warm rebuild** after a code change in a helper: 2 min 46 s of compiling, `horizon-client` only. A comment-only change compiles nothing (31 s). The older native build was pruned. - Tests: - a registry download is a bundle with its pins; - the mods of one build pin one revision, and the error names them; - the key changes with the revision, the horizon-mixins commit and any file; - only changed files are written to the stage; - diagnostics read in one line. `launcher clippy -D warnings` and the launcher tests pass. The CLI reference is regenerated. Size: about 860 lines with tests (~230) and docs (~110). It is one module, so I didn't split it further. ## Needs Ludovic / levzzz - Windows and Linux: the toolchains are pinned in #3179, but a full game build on them is unproven here (Mac mini only). - The window's switch, Mods page and progress screen come in the next PR, which also installs registry entries. This one is CLI only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:08:18 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4838
No description provided.