Zork (Dungeon) built with the Zig build system.
  • Nix 61.5%
  • Zig 38.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-28 21:32:40 -05:00
.tangled/workflows convert CI workflow to the microvm engine 2026-08-28 21:32:40 -05:00
LICENSES license flake.lock under CC0-1.0 with no copyright holder 2026-08-28 21:30:43 -05:00
.gitignore add SPDX headers for REUSE compliance 2026-08-28 21:29:29 -05:00
build.zig add SPDX headers for REUSE compliance 2026-08-28 21:29:29 -05:00
build.zig.zon add SPDX headers for REUSE compliance 2026-08-28 21:29:29 -05:00
build.zig.zon.nix add SPDX headers for REUSE compliance 2026-08-28 21:29:29 -05:00
flake.lock update flake 2026-08-28 21:18:27 -05:00
flake.nix add SPDX headers for REUSE compliance 2026-08-28 21:29:29 -05:00
README.md add SPDX headers for REUSE compliance 2026-08-28 21:29:29 -05:00
REUSE.toml license flake.lock under CC0-1.0 with no copyright holder 2026-08-28 21:30:43 -05:00
typos.toml add SPDX headers for REUSE compliance 2026-08-28 21:29:29 -05:00

zig-zork

Zork (a.k.a. Dungeon), built with the Zig build system.

This project packages devshane/zork — the C port of the original 19771981 MIT mainframe Zork — using zig build in place of the original Makefile. The game source is pulled in as a Zig package dependency; no code is vendored here.

Requirements

  • Zig 0.16
  • termcap (headers and library)
  • A C compiler is not needed separately — Zig compiles the C sources.

Building

zig build

The results land in zig-out/:

  • zig-out/bin/zig-zork — the game
  • zig-out/share/zork/dtextc.dat — the game data file (its absolute install path is baked into the binary at compile time, so use --prefix if you want to install somewhere permanent)
  • zig-out/share/man/man6/dungeon.6 — the manpage

To build and play in one step:

zig build run

Build options

Option Default Description
-Dallow-gdt false Enable the in-game debugging tool, invoked by typing gdt. Not much use except for debugging.
-Doptimize=... Debug Standard Zig optimization mode, e.g. ReleaseSafe or ReleaseFast.
-Dtarget=... native Standard Zig cross-compilation target.

Nix

A flake is included:

# Play the game
nix run .#zig-zork

# Build the package
nix build .#zig-zork

# Development shell with Zig, termcap, and tooling
nix develop

The flake builds with Zig's --system mode using dependencies pre-fetched via zon2nix; after changing dependencies in build.zig.zon, regenerate build.zig.zon.nix with zon2nix.

Playing

You are standing in an open field west of a white house, with a boarded front door. Type commands like open mailbox, go north, or take lamp. See the dungeon(6) manpage for details, or type help in-game. Save yourself some grief: don't wake the thief.