Prerequisites: enable flakes
Miso’s Nix support requires Nix Flakes.Binary cache
Miso maintains a binary cache on Cachix that stores pre-built artifacts for all supported targets. Using it avoids compiling GHC, GHCJS, and the WASM toolchain from source.flake.nix:
GitHub Actions
Add the following step to your CI workflow to populate and read from the cache:Pinned nixpkgs
Miso pins a specific revision of nixpkgs to guarantee that all packages — including the GHCJS 9.12.2 cross-compiler and Emscripten — are known to work together:Dev shells
Miso’s flake exposes several dev shells, each configured for a specific compilation target.- WASM (recommended)
- GHCJS (JS backend)
- Default (GHC)
- HLS
The WASM shell provides GHC 9.12.2 WASM, Inside the shell:See Hot reload for full details.
ghciwatch for hot reload, and http-server.Available packages
Quick start with miso-sampler
The fastest way to get a Nix-based miso project running:Reference: haskell-miso.org
The haskell-miso.org repository demonstrates:- A two-executable
cabalproject (client + server) withbuildablecontrolled by the compiler - A
default.nixthat builds both executables and bundles them for deployment - NixOS module usage for hosting the application