···11+# Contributing
22+33+## Prerequisites
44+55+- A Linux host with flake-enabled [Nix](https://nixos.org/download). Nix
66+ bootstraps every other dependency, including the `just` command runner and
77+ toolchains.
88+- Clone this repository and enter `nix develop` (or
99+ `echo 'use flake' > .envrc && direnv allow`, if you use direnv) to get the
1010+ pinned environment.
1111+1212+## Repository layout
1313+1414+- `packages/*/package.nix`: package definitions for wasm32-linux.
1515+- `overrides/*/src`: ejected sources for packages you are actively hacking on.
1616+- `all-packages.nix`: top-level package set wiring together the wasm packages
1717+ and their overrides.
1818+- `host-packages.nix`: mirrors the wasm packages with their nixpkgs equivalents
1919+ for cross-compilation.
2020+- `flake.nix`: entry point for developing and building with Nix flakes.
2121+2222+## Building and running
2323+2424+- `just run` builds and starts the system in your terminal. Run
2525+ `just run --help` for debug flags and host integration options.
2626+- `just serve` hosts the same site published at https://linux.tombl.dev so you
2727+ can poke it locally with browser devtools.
2828+- `just build <pkg>` rebuilds only the package you name after you have ejected
2929+ it (see below). Use this for iteration on specific components.
3030+3131+## Working with overrides
3232+3333+- `just eject <pkg>` copies the upstream source for that package into
3434+ `overrides/<pkg>/src`.
3535+- Once ejected, subsequent `just build <pkg>` invocations compile from the
3636+ override outside the Nix sandbox, so normal incremental build tools keep
3737+ working.
3838+3939+## Debugging tips
4040+4141+- Enable DWARF debugging information by setting `config.debug = true` in
4242+ `all-packages.nix` before rebuilding.
4343+- Use Chrome DevTools with the
4444+ [DWARF debug extension](https://goo.gle/wasm-debugging-extension)