rumpk/apps/init/init.nim

41 lines
1.4 KiB
Nim

# SPDX-License-Identifier: LSL-1.0
# Copyright (c) 2026 Markus Maiwald
# Stewardship: Self Sovereign Society Foundation
#
# This file is part of the Nexus Sovereign Core.
# See legal/LICENSE_SOVEREIGN.md for license terms.
## Sovereign Init: The Genesis Process
##
## Responsible for bootstrapping the system, starting core services,
## and managing the lifecycle of the user environment.
import ../../libs/membrane/libc
# --- Entry Point ---
proc main() =
# 1. Pledge Sovereignty
discard pledge(0xFFFFFFFFFFFFFFFF'u64) # PLEDGE_ALL
print(cstring("\n"))
print(cstring("\x1b[1;35m╔═══════════════════════════════════════╗\x1b[0m\n"))
print(cstring("\x1b[1;35m║ SOVEREIGN INIT (NexInit v0.1) ║\x1b[0m\n"))
print(cstring("\x1b[1;35m╚═══════════════════════════════════════╝\x1b[0m\n\n"))
print(cstring("[INIT] System Ready. Starting heartbeat...\n"))
print(cstring("[INIT] Spawning Sovereign Shell (Mksh)...\n"))
# Attempt to handover control to Mksh
# execv(path, argv) - argv can be nil for now
if execv(cstring("/bin/mksh"), nil) < 0:
print(cstring("\x1b[1;31m[INIT] Failed to spawn shell! Entering fallback loop.\x1b[0m\n"))
while true:
# 🕵️ DIAGNOSTIC: BREATHER
pump_membrane_stack()
yield_fiber()
when isMainModule:
main()