nx_nxsite_spec.nx
buildroot/runtime/hub/nx_nxsite_spec.nx
about
nx_nxsite_spec.nx -- V-PROV-1: sealed NxSiteDeploymentSpec struct +
sealed-enum kinds + per-field constants.
Per NISHI_SITE_PROVISIONING_CHARTER §3: ONE sealed declarative spec
drives all three frontends (CLI / UI / AI) -> one provisioner backend.
This module defines the data model; parser (nx_nxsite_parse) reads
.nxsite files; validator (nx_nxsite_validate) checks integrity;
applier (nx_site_provisioner) executes.
COMPOSES (per "avoid duplicate primitives"):
nx_syscalls.sys_mmap (struct allocation)
Reuses NxVHostTable + nx_pages_config conventions where applicable
COMPOSED BY:
hub/nx_nxsite_parse.nx (line-walker fills this struct from .nxsite text)
hub/nx_nxsite_validate.nx (checks sealed-enum ranges + cross-section consistency)
hub/nx_site_provisioner.nx (V-PROV-2; applies sealed spec to live substrate)
V-PROV-1 SCOPE:
- 9 sealed sections (per charter §3.2): site, dns, tls, content,
auth, routes, rate_limit, telemetry, deploy
- Sealed enum kinds for cert_kind, content_format, route_handler
- String pool storage (caller-allocated; M4 buf-own)
- Per-section sub-arrays (DNS records, routes, rate_limit buckets)
Status: V-PROV-1. 2026-05-27.
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
structs
| 122 | struct NxNspecDnsRecord |
| 135 | struct NxNspecRoute |
| 144 | struct NxNspecRateBucket |
| 159 | struct NxSiteDeploymentSpec |
consts
| 31 | const NX_NSPEC_OK: i64 = 0 |
| 32 | const NX_NSPEC_BAD_INPUT: i64 = 3500 |
| 33 | const NX_NSPEC_POOL_FULL: i64 = 3501 |
| 34 | const NX_NSPEC_TOO_MANY_RECORDS: i64 = 3502 |
| 35 | const NX_NSPEC_TOO_MANY_ROUTES: i64 = 3503 |
| 36 | const NX_NSPEC_TOO_MANY_BUCKETS: i64 = 3504 |
| 37 | const NX_NSPEC_VALUE_TOO_LONG: i64 = 3505 |
| 38 | const NX_NSPEC_BAD_ENUM: i64 = 3506 |
| 41 | const NX_NSPEC_STRING_POOL_CAP: i64 = 65536 // 64 KB packed string pool |
| 42 | const NX_NSPEC_MAX_DNS_RECORDS: i64 = 64 |
| 43 | const NX_NSPEC_MAX_ROUTES: i64 = 32 |
| 44 | const NX_NSPEC_MAX_RATE_BUCKETS: i64 = 16 |
| 45 | const NX_NSPEC_MAX_FIELD_LEN: i64 = 1024 // per-value cap |
| 46 | const NX_NSPEC_MAX_NAME_LEN: i64 = 255 // hostname per RFC 1035 |
| 47 | const NX_NSPEC_SPEC_VERSION: *u8 = "1.0.0" as *u8 |
| 48 | const NX_NSPEC_SPEC_VERSION_N: i64 = 5 |
| 51 | const NX_NSPEC_CERT_KIND_NONE: i64 = 0 |
| 52 | const NX_NSPEC_CERT_KIND_SOVEREIGN_SELF: i64 = 1 // sovereign self-signed |
| 53 | const NX_NSPEC_CERT_KIND_SOVEREIGN_MINI_CA: i64 = 2 // sovereign operator-CA-issued (V+2) |
| 54 | const NX_NSPEC_CERT_KIND_N: i64 = 3 |
| 64 | const NX_NSPEC_CONTENT_NONE: i64 = 0 |
| 65 | const NX_NSPEC_CONTENT_NISHI_PAGE_V1: i64 = 1 |
| 66 | const NX_NSPEC_CONTENT_STATIC_HTML: i64 = 2 |
| 67 | const NX_NSPEC_CONTENT_MIRROR_LAYER: i64 = 3 |
| 68 | const NX_NSPEC_CONTENT_N: i64 = 4 |
| 79 | const NX_NSPEC_ROUTE_NONE: i64 = 0 |
| 80 | const NX_NSPEC_ROUTE_STATIC: i64 = 1 |
| 81 | const NX_NSPEC_ROUTE_WIKI_DAEMON: i64 = 2 |
| 82 | const NX_NSPEC_ROUTE_SEARCH_HANDLER: i64 = 3 |
| 83 | const NX_NSPEC_ROUTE_ADMIN_PANEL: i64 = 4 |
| 84 | const NX_NSPEC_ROUTE_SITE_API: i64 = 5 |
| 85 | const NX_NSPEC_ROUTE_404: i64 = 6 |
| 86 | const NX_NSPEC_ROUTE_N: i64 = 7 |
| 100 | const NX_NSPEC_DNS_NONE: i64 = 0 |
| 101 | const NX_NSPEC_DNS_A: i64 = 1 |
| 102 | const NX_NSPEC_DNS_AAAA: i64 = 2 |
| 103 | const NX_NSPEC_DNS_MX: i64 = 3 |
| 104 | const NX_NSPEC_DNS_TXT: i64 = 4 |
| 105 | const NX_NSPEC_DNS_CNAME: i64 = 5 |
| 106 | const NX_NSPEC_DNS_NS: i64 = 6 |
| 107 | const NX_NSPEC_DNS_N: i64 = 7 |
| 132 | const NX_NSPEC_DNS_RECORD_BYTES: i64 = 56 |
| 141 | const NX_NSPEC_ROUTE_BYTES: i64 = 24 |
| 152 | const NX_NSPEC_RATE_BUCKET_BYTES: i64 = 40 |
functions
| 56 | func nx_nspec_cert_kind_name(k: i64) -> *u8 |
| 70 | func nx_nspec_content_format_name(f: i64) -> *u8 |
| 88 | func nx_nspec_route_handler_name(h: i64) -> *u8 |
| 109 | func nx_nspec_dns_kind_name(k: i64) -> *u8 |
| 241 | func nx_nxsite_spec_init(s: *NxSiteDeploymentSpec, calls 1: sys_mmap |
| 303 | func nx_nspec_pool_append(s: *NxSiteDeploymentSpec, |
| 318 | func nx_nspec_dns_record_at(s: *NxSiteDeploymentSpec, i: i64) -> *NxNspecDnsRecord |
| 325 | func nx_nspec_route_at(s: *NxSiteDeploymentSpec, i: i64) -> *NxNspecRoute |
| 332 | func nx_nspec_rate_bucket_at(s: *NxSiteDeploymentSpec, i: i64) -> *NxNspecRateBucket |
| 341 | func nx_nspec_dns_add(s: *NxSiteDeploymentSpec, |
| 359 | func nx_nspec_route_add(s: *NxSiteDeploymentSpec, |
| 373 | func nx_nspec_rate_add(s: *NxSiteDeploymentSpec, |
| 393 | func nx_nspec_site_name(s: *NxSiteDeploymentSpec, out_ptr: *i64, out_n: *i64) -> i64 |
| 400 | func nx_nspec_dns_records_count(s: *NxSiteDeploymentSpec) -> i64 |
| 405 | func nx_nspec_routes_count(s: *NxSiteDeploymentSpec) -> i64 |
| 410 | func nx_nspec_rate_buckets_count(s: *NxSiteDeploymentSpec) -> i64 |