nx_build_site.nx
buildroot/runtime/nx_build_site.nx
about
nx_build_site.nx -- bits-up site builder. Replaces
nishi-pages/build/build.py (530 LOC Python) with NishiLang
substrate. Per user *"no python nothing but nishi from bits up"*.
Pipeline:
1. Read content/site.yaml -> NxYamlDoc site vars (lifted to site.*)
2. Read theme templates: layout.html, index.html, post.html, page.html
3. For each .md in content/posts/:
nx_build_doc round-trip
emit a post-summary HTML block (for the homepage posts list)
write dist/posts/<slug>.html
4. For each .md in content/pages/:
nx_build_doc round-trip with PAGE template
write dist/pages/<slug>.html
5. Build the homepage:
substitute site.* + posts_html (concatenated summaries)
wrap with layout.html
write dist/index.html
What this v1 does NOT do (queued):
- Dynamic directory walking (uses a hardcoded list of slugs)
- dist/404.html generation
- style.css copy to dist/assets/
- server/pages.nx route emit
These are easy follow-ups that compose with what's here.
Memory budget (one rendering pass):
~64K per .md scratch
~32K per template
~256K total site arena
nx_safety_envelope:
intended_use: sovereign substrate builder for nishi-pages
sil_target: SIL2
evidence: bench/nx_build_site_smoke.nx renders a fixture
tree end-to-end and asserts output bytes
verdict: NOT_YET_EVALUATED -- pending smoke
dependencies 6 imports · 0 importers
imports: nx_syscalls_x86_64.nxnx_yaml_subset.nxnx_frontmatter.nxnx_http_template.nxnx_md_render.nxnx_build_doc.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 48 | const NX_BS_OK: i64 = 0 |
| 49 | const NX_BS_BAD_INPUT: i64 = 1 |
| 50 | const NX_BS_READ_FAIL: i64 = 2 |
| 51 | const NX_BS_WRITE_FAIL: i64 = 3 |
| 52 | const NX_BS_RENDER_FAIL: i64 = 4 |
| 53 | const NX_BS_PATH_TOO_LONG: i64 = 5 |
| 54 | const NX_BS_VERDICT_N: i64 = 6 |
| 58 | const NX_BS_PATH_CAP: i64 = 512 |
| 59 | const NX_BS_HTML_CAP: i64 = 65536 // 64K per rendered page |
functions
| 63 | func _bs_bcopy(dst: *u8, dst_off: i64, dst_cap: i64, |
| 77 | func nx_bs_join(out: *u8, out_cap: i64, |
| 98 | func nx_bs_read_file(path: *u8, out_n: *i64) -> *u8 |
| 104 | func nx_bs_write_file(path: *u8, buf: *u8, n: i64) -> i64 |
| 121 | func nx_bs_render_doc(md_path: *u8, |
| 208 | func nx_bs_load_theme(base_dir: *u8, base_n: i64, |
| 244 | func nx_bs_load_site_yaml(base_dir: *u8, base_n: i64) -> *NxYamlDoc |
| 263 | func nx_bs_render_one_post(base_dir: *u8, base_n: i64, |
| 304 | func nx_bs_append_post_summary(out: *u8, out_off: i64, out_cap: i64, |
| 355 | func nx_bs_load_post_yaml(base_dir: *u8, base_n: i64, called by 1: nx_bs_render_homepage calls 4: _bs_bcopynx_bs_read_filenx_frontmatter_splitnx_yaml_parse |
| 391 | func nx_bs_render_homepage(base_dir: *u8, base_n: i64, |
| 465 | func nx_bs_render_404(base_dir: *u8, base_n: i64, |
| 496 | func nx_bs_copy_style_css(base_dir: *u8, base_n: i64) -> i64 |
| 516 | func nx_bs_render_one_page(base_dir: *u8, base_n: i64, |