code wiki / (root) / nx_container_spec_emit.nx

nx_container_spec_emit.nx

buildroot/runtime/nx_container_spec_emit.nx

7247 B154 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic container
docsdependenciesstructsconstsfunctions

about

nx_container_spec_emit.nx -- R1 of the Nishi Container Host: SPEC-DRIVEN container emit (the sovereign `docker build`). Reads a ContainerSpec (data: cmdline + out path) and STAMPS it onto the PROVEN governance-binary TEMPLATE (nx_pe_container_sdserver.exe): .text/.idata = the immutable Job-Object base layer; .data = the per-service cmdline. = ONE emitter governs ANY service per spec, killing the hand-authored-container-organ-per-service copy-paste (Rule 15). NEVER-BRICK by construction: refuses a cmdline that would overflow the template .data (Rule 12, bounds at the front door). GATE: same-cmdline stamp -> byte-identical to template (lossless); diff-cmdline -> only .data changes (.text/.idata immutable); over-long -> refused. NO fake greens. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_runtime.nx nx_container_spec_emit.nx

imports: nx_syscalls.nxnx_runtime.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main csp_p csp_w sys_write sys_mmap csp_read sys_openat_rd sys_read sys_close csp_copy csp_stamp csp_strlen csp_zero csp_put_utf16 csp_cmp csp_get_str csp_strlen ↻ csp_find sys_openat_wr sys_write ↻ sys_close ↻ csp_pn csp_wn sys_mmap ↻ sys_write ↻

structs

none

consts

10const TPL_MAGIC_8192: i64 = 8192
11const TPL_MAGIC_8191: i64 = 8191
12const TPL_MAGIC_2048: i64 = 2048
13const TPL_MAGIC_1024: i64 = 1024
15const TEMPLATE: *u8 = "/mnt/c/Users/elder/elder-ai-platform/services/sdcpp/elder-sdcpp/build-nishi-cuda/bin/nx_pe_container_sdserver.exe"
16const SPEC: *u8 = "knowledge/containers/elderai.spec"
17const TPL_SIZE: i64 = 0xA00
18const DATA_OFF: i64 = 0x400
19const DATA_CAP: i64 = 0x400
20const SD_CMD: *u8 = "sd-server.exe --diffusion-model C:/Users/elder/elder-ai-platform/models/unified/diffusion/zimage_turbo_nsfw_2602-Q8_0.gguf --llm C:/Users/elder/elder-ai-platform/models/unified/text_encoder/Z-Image_Qwen_3_4b-Q6_K.gguf --vae C:/Users/elder/elder-ai-platform/models/unified/vae/ae.safetensors --listen-port 7861"

functions

22func csp_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 1: csp_p calls 1: sys_write
23func csp_wn(fd: i64, v: i64) -> i64
called by 1: csp_pn calls 2: sys_mmapsys_write
36func csp_p(s: *u8) -> i64 { return csp_w(1, s) }
called by 1: main calls 1: csp_w
37func csp_pn(v: i64) -> i64 { return csp_wn(1, v) }
called by 1: main calls 1: csp_wn
38func csp_strlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
40func csp_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
53func csp_find(buf: *u8, n: i64, pat: *u8, pl: i64) -> i64
called by 1: csp_get_str
65func csp_get_str(buf: *u8, n: i64, key: *u8, out: *u8, outcap: i64) -> i64
called by 1: main calls 2: csp_strlencsp_find
78func csp_zero(buf: *u8, off: i64, len: i64) -> i64 { var i: i64 = 0; while i < len { buf[off+i] = 0 as u8; i = i + 1 } return 0 }
called by 1: csp_stamp
79func csp_put_utf16(buf: *u8, off: i64, s: *u8) -> i64
called by 1: csp_stamp
86func csp_cmp(a: *u8, b: *u8, off: i64, len: i64) -> i64 { var i: i64 = 0; while i < len { if a[off+i] != b[off+i] { return 1 } i = i + 1 } return 0 }
called by 1: main
87func csp_copy(dst: *u8, src: *u8, len: i64) -> i64 { var i: i64 = 0; while i < len { dst[i] = src[i]; i = i + 1 } return 0 }
called by 1: main
89func csp_stamp(out_buf: *u8, cmd: *u8) -> i64
97func main() -> i64