Nox
Download

Start here

What's new in Nox 2.1

Nox 2.1 keeps every 2.0 promise (the stability policy is unchanged) and adds what the 2.0 line grew into: Nox in the browser and on WebAssembly, a much stronger HTTP stack, real cross-compilation, scripts, and a safer release and standard library. Nothing that compiled on 2.0 stops compiling; the few behaviour changes are listed under Upgrading.

Nox runs everywhere WebAssembly does#

  • WebAssembly targets. noxc build --target wasm32-wasi and wasm32-freestanding compile through LLVM, with real fibers (--asyncify) and real parallel tasks (--threads). Most of the standard library works there, including nox.http (client and server), nox.sqlite, nox.postgres, nox.mysql, nox.websocket, nox.process and a persistent virtual file system. Host capabilities are opt-in and can be denied (--deny-capability). See WebAssembly.
  • The compiler in the browser. The front end ships as noxc-frontend.wasm; together with a WebAssembly C toolchain it compiles and runs Nox entirely client-side (Browser compiler).
  • The Playground. noxlang.com/playground (beta) is written in Nox and runs your program in the page; nothing is sent to a server (Playground).

Cross-compile from any machine#

noxc build --target <name> now produces macos-arm64, macos-x64, linux-x64, linux-arm64, linux-riscv64 and windows-x64 programs from any host with zig. They go through the LLVM back end by default, so cross-built programs run at -O2 speed, and a Windows .exe built on Linux is run on Windows in CI on every change (Back ends).

On phones (experimental)#

The four mobile targets (ios-arm64, ios-simulator-arm64, android-arm64, android-x64) now reach nearly the same standard-library coverage as WebAssembly: 45 of the 50 standard-library modules compile for them (WebAssembly: 46), and the five that do not are platform rules (nox.process, nox.native, nox.plugin, nox.hpy, nox.sharedmem). nox.postgres and nox.mysql work through drivers written in Zig, because a phone has no libpq or libmysqlclient (PostgreSQL uses TLS with sslmode=require; the MySQL driver has no TLS yet, so use it only on a network you trust). The whole fixture corpus, 468 programs, runs on the iOS simulator and on the Android emulator with identical output, and CI repeats it. The mobile targets stay experimental: there is no physical-device lab yet (Mobile support matrix).

Scripts#

Put #!/usr/bin/env -S noxc run on the first line and chmod +x: a Nox file runs like a script, arguments included, with the compiled binary cached between runs (Scripts).

A stronger HTTP stack#

HTTP/2 on the server (TLS ALPN and h2c, trailers, WebSocket over HTTP/2), streaming responses and server-sent events, graceful shutdown with a drain period, connection pooling and proxy support for the client, and nox.web for building applications (HTTP, Web).

Language#

Generators and yield, __del__, real multiple inheritance, and streaming file and HTTP bodies landed during the 2.0 line. See the language reference.

Safer by default#

  • nox.path.safe_join(root, requested) confines an untrusted path under a root, rejecting .., symbolic-link escapes and sibling directories (Path). strip_prefix now respects component boundaries.
  • Signed releases and a bill of materials. Every archive carries a build-provenance attestation you can check with gh attestation verify, and each release ships an SPDX software bill of materials (Install). A release is published only after every platform archive is uploaded.
  • Fuzzing of the parsers that read untrusted bytes: the HTTP/2 header decoder and the MySQL protocol client join the compiler front end and the WebAssembly parser.
  • extern def ... from "path" now finds a relative library from the project root, so building from a subdirectory works (FFI).

Tooling and distribution#

noxc login, whoami, publish; a progress display; noxc upgrade that respects package managers. Installers for every platform: Homebrew, AUR (noxc-bin), AppImage, Snap and a Windows installer. noxlang.com has a new download page that detects your system, more tutorials, and a registry (noxpkg) with publisher identity.

Upgrading#

Run noxc upgrade (or your package manager). Behaviour changes:

  • noxc run script.nox a b passes everything after the file to the program. Compiler options go before the file (noxc run --backend qbe script.nox); -- is still accepted.
  • noxc build --backend llvm --target <desktop> now builds (it used to be an error); --target without --backend uses LLVM when zig is installed. -g, --emit-asm and freestanding builds stay on QBE.
  • nox.path.strip_prefix("/srv/dataevil/x", "/srv/data") now returns the path unchanged instead of evil/x.

The full list is in the changelog.