Skip to content

nethack: preserve playable curses and persistent saves#58

Open
brandonpayton wants to merge 2 commits into
mainfrom
migrate/nethack-game
Open

nethack: preserve playable curses and persistent saves#58
brandonpayton wants to merge 2 commits into
mainfrom
migrate/nethack-game

Conversation

@brandonpayton

@brandonpayton brandonpayton commented Jul 11, 2026

Copy link
Copy Markdown
Member

Purpose

Migrate NetHack 3.6.7 from the registry into a first-class Homebrew Formula without reducing it to a noninteractive demo. Build upstream game/data from source, link tap ncurses, and preserve real curses play, scores, fork instrumentation, and persistent save state.

Source and build

  • Official source: https://www.nethack.org/download/3.6.7/nethack-367-src.tgz
  • Source SHA-256: 98cf67df6debf9668a61745aa84c09bcab362e5d33f5b944ec5155d44d2aacb2
  • Direct target dependency: full-name tap ncurses
  • Native data generators run through declared host tooling
  • Final target executable is optimized, fork-instrumented, and validated before installation
  • Generated nhdat, symbols, license, and manpage are installed

The port fixes upstream host/wasm serialization-width assumptions and terminal fallback at source level; no runtime wrapper is introduced.

Persistent state

Stable guest paths:

  • data: /home/linuxbrew/.linuxbrew/opt/nethack/share/nethack
  • mutable state: /home/linuxbrew/.linuxbrew/var/nethack

post_install creates state files and save/ without overwriting existing data. Formula tests use an isolated writable mount rather than mutating the installed prefix or assuming a writable root image.

Exact source head

Base: c5705667a90b05754d2244a362f3f7fc95d2f9c3

Head: c267f37fa6657395e6595204445d024418bf6aeb

Two-commit shape:

  1. 21db9ca57555479db69411fece19e5baca8bd824 preserves the accepted functional Formula byte-for-byte; README context is the only restack difference.
  2. c267f37fa6657395e6595204445d024418bf6aeb adds Binaryen/WABT, validates final post-instrumentation bytes with shared fork: :required, and removes weaker duplicate test-time generic guards.

Accepted functional Formula SHA-256: 55628b33acda6680cbd5b738aa79bfa24b9d0867b04454b6483e0a1a2447ad47

Final Formula SHA-256: c4f7814effcb0bc4355d50672c49aa771008e2f0091c7d306ef38a03504480ed

Exact syntax, diff, ancestry, clean-worktree, and static contract checks pass; shared support passes 37 runs / 279 assertions. A fresh final-head source build/test was not run.

Historical functional evidence

The accepted implementation previously established on ABI 18:

  • two clean builds: NetHack 293cb574de1e1a02cfa6c17efe3b01c99068aacabd54ae638095e17ec7ea97d8; nhdat 57f30deb73838e091bdb9e41c9bca9b85b710f82e0b27beaa12350f26441f97c
  • registered install, post_install, and reinstall state preservation
  • version, paths, data, score, and two-run Node PTY save/restore
  • 5,412,101-byte artifact reports ABI 18, real fork import, complete continuation exports, no Asyncify, and no host paths under exact #882 inspection

The first run saved a supported character and the second printed Restoring save file...; both exercised alternate-screen lifecycle.

These are historical functional results, not current-head source-build, ABI 39 bottle, or Chromium evidence. Do not cite the earlier 202895... false-positive artifact.

Gates

Final platform baseline is exact #907 / ABI 39. Source/artifact gates are #873, #882, and deterministic #888-on-#889. #903 is unnecessary because the exact 5.4 MB artifact passes #882 inspection. #905/#892/#895 are unrelated to the Formula's direct fork/persistence test.

Publication stack is #881 -> #887 -> #890 -> #885 plus tap #22 and #900. #887 covers Binaryen/WABT; #890/#900 prove the recursive same-tap dependency closure.

Final dependency order is libcxx -> ncurses -> NetHack. Publish/pour exact ABI 39 libcxx and ncurses first, build NetHack from those poured bottles, then run a naturally passing literal Node Formula test and stock Chromium character selection, save, relaunch, and restore with persistent state.

#907's registry NetHack/browser-bundle matrix and existing browser nethack -s smoke are platform setup evidence only; they do not prove a Homebrew bottle pour or gameplay persistence.

No bottle block, binary artifact, platform change, or ABI change is included.

@brandonpayton brandonpayton force-pushed the migrate/nethack-game branch from 9e895e5 to c267f37 Compare July 13, 2026 02:50
@brandonpayton

Copy link
Copy Markdown
Member Author

Independent exact-head review completed for c267f37fa6657395e6595204445d024418bf6aeb: ACCEPT for source review; not merge/publish ready.

  • Functional recipe bytes are preserved; the contract commit adds Binaryen/WABT and shared pre-install fork-required validation while removing only duplicate generic guards.
  • Exact ncurses/tinfo closure and stable state paths are coherent; package-specific install/path/persistence tests remain.
  • Support 37/279 and static checks pass. Historical ABI 18 Node save/restore evidence is functional evidence only; no fresh final-head build or bottle is claimed.
  • Source gates are #873/#882/#888-on-#889 with exact #907/ABI39 final baseline. #903/#905/#892/#895 do not gate current claims.
  • Publication requires #900 dependency provenance in order libcxx -> ncurses -> NetHack, trusted bottle publication, a literal Node test, and real Chromium character selection/save/relaunch/restore.

No Formula blocker was found. Registry/browser-smoke artifacts are not Homebrew bottle evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant