Packaging
Slim vs. fat packaging for distributing your nx.js app
When you package an nx.js app into a .nro (homebrew menu) or .nsp (installed
title), you choose how the runtime is bundled. There are two modes: slim
(the default) and fat.
Slim vs. fat
| Slim (default) | Fat | |
|---|---|---|
| App file size | A few hundred KB | ~40 MB (NRO) / ~21 MB (NSP) |
| Runtime | Shared, installed once at sdmc:/nx.js/ | Embedded in every app |
| Best for | Most apps; multiple nx.js apps on one console | Self-contained distribution |
A slim app is a tiny launcher. At boot it chainloads a shared nx.js
runtime NRO installed at sdmc:/nx.js/nxjs-v<version>.nro, selected by the
[runtime] version semver requirement baked
into the app's nxjs.ini. Many slim apps can share a single runtime, so you
don't pay the ~40 MB cost per app.
A fat app embeds the entire runtime, so it is fully self-contained and runs without anything else installed.
Note
Slim became the default in @nx.js/nro v1 (previously every NRO was fat).
Building
The packaging scripts produced by the templates are
nxjs-nro and
nxjs-nsp. They build slim by
default; pass --fat (or set the NXJS_FAT=1 environment variable) for a
self-contained build:
# Slim (default)
npm run nro
# Fat (self-contained)
npx nxjs-nro --fatTip
When scaffolding with create-nxjs-app, you're
prompted to choose slim or fat. Choosing fat adds the --fat flag to the
generated nro/nsp scripts.
Installing the shared runtime (slim)
A slim app needs a compatible shared runtime present on the SD card under
sdmc:/nx.js/. There are two ways this happens:
- Automatic download. If no compatible runtime is installed, the slim
bootstrap launcher downloads one automatically from the nx.js GitHub releases
over the network, shows an on-screen progress indicator, saves it to
sdmc:/nx.js/nxjs-v<version>.nro, and continues launching. A freshly- installed slim app "just works" on a network-connected console. - Manual. Download a runtime
nxjs.nrofrom the releases and place it atsdmc:/nx.js/nxjs-v<version>.nro. (If the automatic download can't proceed, the launcher shows these instructions on-screen.)
Multiple runtime versions can coexist under sdmc:/nx.js/; each slim app picks
the highest installed version that satisfies its requirement.
NSP packaging
The same slim/fat choice applies to .nsp (installed-title) builds via
nxjs-nsp. A slim NSP uses a tiny forwarder as its executable, which chainloads
the shared runtime and mounts the installed title's own files as romfs:. Pass
--fat for a self-contained NSP.