Installing Nexium

Every way to get nx onto a machine, what each one sets up, and how nx finds its C compiler.

Windows: the installer#

Download nexium-<version>-setup-x64.exe from the Releases page and run it. The wizard offers:

Nothing else is required. Uninstall from Settings; it removes the files and the PATH entry, and leaves programs you compiled alone.

Silent install for scripts: nexium-<version>-setup-x64.exe /VERYSILENT /TASKS=addtopath.

A portable nx-<version>-x86_64-pc-windows-msvc.zip has the same files without the installer or Zig; put its folder on the PATH and have Zig on the PATH yourself.

macOS and Linux: the install script#

curl -fsSL https://raw.githubusercontent.com/Londopy/nexium/main/installers/install.sh | sh

It downloads the release for your platform, verifies the archive against the release's SHA256SUMS.txt, installs nx to ~/.nexium/bin with the examples, standard library sources, and docs under ~/.nexium/share, and adds the bin directory to your PATH in ~/.profile, ~/.bashrc, and ~/.zshrc. On macOS the system compiler from the Xcode command line tools is used (xcode-select --install if missing). On Linux, when no compiler is found, it downloads Zig into ~/.nexium/zig.

Variables: NEXIUM_VERSION=v1.0.2 pins a release, NEXIUM_HOME changes the directory, NEXIUM_NO_MODIFY_PATH=1 leaves shell files alone, NEXIUM_NO_ZIG=1 never downloads Zig. Uninstall by deleting ~/.nexium and the three lines the script added.

From source#

Nothing but a C compiler is needed: sh bootstrap/build.sh (or .\bootstrap\build.ps1) builds nx0 from the C seed the compiler emits for itself, nx0 builds the compiler from self/, and the result rebuilds itself to the same C; nx-out/bootstrap/nx2 is the compiler. CC names the C compiler for the build (default zig cc, cc on macOS); NX_CC or NX_ZIG names the one nx itself runs. See bootstrap/README.md.

In CI#

The Londopy/nexium/.github/actions/setup-nexium action installs nx and Zig on a GitHub runner; see releasing-your-program.md.

How nx finds a C compiler#

In order, the first that applies wins:

  1. --cc <compiler> on the command line.
  2. NX_CC in the environment, for example NX_CC=gcc or NX_CC="clang -fuse-ld=lld".
  3. NX_ZIG=/path/to/zig.
  4. A Zig next to nx: <nx directory>/zig/zig (the Windows installer) or <nx directory>/../zig/zig (~/.nexium).
  5. On macOS, for native builds, the system cc.
  6. zig on the PATH.

nx doctor prints which one is in effect and whether it runs. Cross-compiling (--target) always uses Zig, since that is what makes it possible.

Which CPU a binary is built for#

By default, the baseline of the machine's architecture: on x86-64 that is plain x86-64 (SSE2), so a binary built on one machine runs on every 64-bit x86 machine, which is what a release, a wheel or an installer needs. zig cc on its own compiles for the CPU it runs on, and a compiler built on a machine with AVX-512 crashed with an illegal instruction on one without it (1.0.1). --cpu native (or NX_CPU=native) asks for this machine's CPU, for a program that will only run here; --cpu x86_64_v3 names one (Zig's names with zig cc, -march names with gcc or clang). nx doctor prints the choice, and os.arch() tells a program which architecture it runs on.

An editor#

Every editor gets the same language server: nx lsp speaks LSP over stdio and gives diagnostics as you type, hover with inferred effects, go to definition, completion and rename. The editors/ directory of the repository has the pieces for each one:

editorinstall
VS Codethe "Nexium" extension on the Marketplace, or the .vsix on every release (the Windows installer installs it when code is on the PATH)
VimPlug 'Londopy/nexium', { 'rtp': 'editors/vim' }
Neovimthe editors/neovim plugin: tree-sitter, LSP and the Vim files as fallback
Helixappend editors/helix/languages.toml, copy its queries, hx --grammar fetch && hx --grammar build
ZedInstall Dev Extension on editors/zed
Emacseditors/emacs/nexium-mode.el; registers itself with Eglot and lsp-mode
Kate, KWrite, KDevelop, Qt Creatorcopy editors/kate/nexium.xml into the KSyntaxHighlighting directory
JetBrains IDEseditors/vscode as a TextMate bundle, nx lsp through LSP4IJ
Sublime Textcopy editors/sublime/Nexium.sublime-syntax and Nexium.sublime-build into Packages/User (Ctrl+B runs the file)
Notepad++copy editors/notepad-plus-plus/nexium.udl.xml into %AppData%\Notepad++\userDefineLangs
nanoinclude editors/nano/nexium.nanorc from ~/.nanorc

Each directory has a README with the details.

Verifying downloads#

Every release ships SHA256SUMS.txt and lists the same values on the release page.

sha256sum -c SHA256SUMS.txt --ignore-missing      # Linux
shasum -a 256 -c SHA256SUMS.txt --ignore-missing   # macOS
Get-FileHash .\nexium-1.0.2-setup-x64.exe -Algorithm SHA256

The install script verifies automatically and refuses a mismatch.