nip/docs
Markus Maiwald da6aa7f50a Phase 27-29: Visual Cortex, Pledge, and The Hive
PHASE 27: THE GLYPH & THE GHOST (Visual Cortex Polish)
========================================================
- Replaced placeholder block font with full IBM VGA 8x16 bitmap (CP437)
- Implemented CRT scanline renderer for authentic terminal aesthetics
- Set Sovereign Blue background (0xFF401010) with Phosphor Amber text
- Added ANSI escape code stripper for clean graphical output
- Updated QEMU hints to include -device virtio-gpu-device

Files:
- core/rumpk/libs/membrane/term.nim: Scanline renderer + ANSI stripper
- core/rumpk/libs/membrane/term_font.nim: Full VGA bitmap data
- src/nexus/forge.nim: QEMU device flag
- docs/dev/PHASE_26_VISUAL_CORTEX.md: Architecture documentation

PHASE 28: THE PLEDGE (Computable Trust)
========================================
- Implemented OpenBSD-style capability system for least-privilege execution
- Added promises bitmask to FiberObject for per-fiber capability tracking
- Created SYS_PLEDGE syscall (one-way capability ratchet)
- Enforced capability checks on all file operations (RPATH/WPATH)
- Extended SysTable with fn_pledge (120→128 bytes)

Capabilities:
- PLEDGE_STDIO (0x0001): Console I/O
- PLEDGE_RPATH (0x0002): Read Filesystem
- PLEDGE_WPATH (0x0004): Write Filesystem
- PLEDGE_INET  (0x0008): Network Access
- PLEDGE_EXEC  (0x0010): Execute/Spawn
- PLEDGE_ALL   (0xFFFF...): Root (default)

Files:
- core/rumpk/core/fiber.nim: Added promises field
- core/rumpk/core/ion.nim: Capability constants + SysTable extension
- core/rumpk/core/kernel.nim: k_pledge + enforcement checks
- core/rumpk/libs/membrane/ion_client.nim: Userland ABI sync
- core/rumpk/libs/membrane/libc.nim: pledge() wrapper
- docs/dev/PHASE_28_THE_PLEDGE.md: Security model documentation

PHASE 29: THE HIVE (Userland Concurrency)
==========================================
- Implemented dynamic fiber spawning for isolated worker execution
- Created worker pool (8 concurrent fibers, 8KB stacks each)
- Added SYS_SPAWN (0x500) and SYS_JOIN (0x501) syscalls
- Generic worker trampoline for automatic cleanup on exit
- Workers inherit parent memory but have independent pledge contexts

Worker Model:
- spawn(entry, arg): Create isolated worker fiber
- join(fid): Wait for worker completion
- Workers start with PLEDGE_ALL, can voluntarily restrict
- Violations terminate worker, not parent shell

Files:
- core/rumpk/core/fiber.nim: user_entry/user_arg fields
- core/rumpk/core/kernel.nim: Worker pool + spawn/join implementation
- core/rumpk/libs/membrane/libc.nim: spawn()/join() wrappers
- docs/dev/PHASE_29_THE_HIVE.md: Concurrency architecture

STRATEGIC IMPACT
================
The Nexus now has a complete Zero-Trust security model:
1. Visual identity (CRT aesthetics)
2. Capability-based security (pledge)
3. Isolated concurrent execution (spawn/join)

This enables hosting untrusted code without kernel compromise,
forming the foundation of the Cryptobox architecture (STC-2).

Example usage:
  proc worker(arg: uint64) {.cdecl.} =
    discard pledge(PLEDGE_INET | PLEDGE_STDIO)
    http_get("https://example.com")

  let fid = spawn(worker, 0)
  discard join(fid)
  # Shell retains full capabilities

Build: Validated on RISC-V (rumpk-riscv64.elf)
Status: Production-ready
2026-01-02 14:12:00 +01:00
..
cli Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
schemas Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
security Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
Beyond Devcontainers_ Introducing nexus target devcell.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
DEPENDENCY_RESOLUTION.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
DEVELOPER_GUIDE.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
HASH_ALGORITHM_MIGRATION.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
INTEGRATION_GUIDE.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
License_and_Compliance.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
NIPCELLS_SUPERIORITY.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
NIPPELS_DEVELOPER_GUIDE.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
NIPPELS_EXAMPLES.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
NIPPELS_TROUBLESHOOTING.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
NIPPELS_USER_GUIDE.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
NIPPELS_VS_FLATPAK.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
NIPPELS_VS_PACKAGES.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
NexusOS_Architecture_Overview.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
NexusOS_Package_Management.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
OPTIMIZATION_GUIDE.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
README.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
RESOLVER_DEVELOPER_GUIDE.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
RESOLVER_VISUAL_GUIDE.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
USER_GUIDE.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
arch-linux-guide.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
architecture.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
automatic-updates.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
binary-cache.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
bootstrap-api.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
bootstrap-detection-flow.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
bootstrap-guide.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
bootstrap-overview.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
build-configuration.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
build-examples.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
build-flow.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
build-system-help.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
build-troubleshooting.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
build_system.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
butane_ignition_integration for internet deployments.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
cas-security-architecture.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
container-builds.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
dependency-resolution.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
enhanced-cli-interface.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
formats_and_concepts.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
gentoo-nix-guide.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
getting-started.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
init_systems.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
json-output.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
learning-nim.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
license_json_examples.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
license_yaml_examples.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
nexus Package Formats and Their Purposes.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
nexus_targets.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
nexusos_commercial_badge.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
nexusos_licensing.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
nexusos_overview.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
nimpak_types_reference.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
nip_verify_acul_enforcement.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
nipcell-usage.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
nipcells.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
platform-detection.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
quick-reference.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
remote-cache.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
remote-repository-specification.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
remote_cli_guide.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
roadmap.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
security-and-verification-system.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
security-features.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
security_event_logging.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
shell-guide.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
shell-interface.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
source-build-guide.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
static-build-guide.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00
vision.md Phase 27-29: Visual Cortex, Pledge, and The Hive 2026-01-02 14:12:00 +01:00

README.md

NIP Documentation

Welcome to the NIP documentation! This guide will help you find what you need.

New to NIP?

Start here:

  1. Getting Started Guide - Complete introduction with examples
  2. Quick Reference - Command cheat sheet
  3. Bootstrap Overview - Understanding automatic build tool management

User Guides

Package Management

Bootstrap System

Build System

Advanced Topics

Developer Guides

Bootstrap System

Build System

Package Format

Reference

Command Line

Configuration

Security

Quick Navigation

I want to...

Install a packageGetting Started Guide

Build from sourceSource Build Guide

Understand automatic bootstrapBootstrap Overview

Use NIP on Arch LinuxArch Linux Guide

Build in containersGetting Started Guide

Manage build toolsBootstrap Guide

Troubleshoot buildsBuild Troubleshooting

Create custom recipesRecipe Authoring Guide

Understand the APIBootstrap API

Documentation Structure

docs/
├── README.md                          # This file
├── getting-started.md                 # Start here!
│
├── User Guides/
│   ├── bootstrap-overview.md          # Bootstrap system overview
│   ├── bootstrap-guide.md             # Bootstrap usage
│   ├── bootstrap-detection-flow.md    # Detection logic
│   ├── source-build-guide.md          # Source building
│   ├── arch-linux-guide.md            # Arch Linux workflow
│   ├── build-flow.md                  # Build process
│   ├── build-configuration.md         # Build config
│   ├── build-examples.md              # Build examples
│   └── build-troubleshooting.md       # Troubleshooting
│
├── Developer Guides/
│   ├── bootstrap-api.md               # Bootstrap API
│   ├── architecture.md                # System architecture
│   ├── build-system-help.md           # Build internals
│   └── nimpak_types_reference.md      # Type reference
│
├── Reference/
│   ├── enhanced-cli-interface.md      # CLI reference
│   ├── json-output.md                 # JSON format
│   ├── security-features.md           # Security
│   └── formats_and_concepts.md        # Package formats
│
└── schemas/                           # JSON schemas

Contributing to Documentation

Found an issue or want to improve the docs?

  1. Documentation lives in nip/docs/
  2. Use Markdown format
  3. Follow existing structure and style
  4. Test all code examples
  5. Update this index when adding new docs

Getting Help

Documentation Status

Document Status Last Updated
Getting Started Complete 2025-11
Bootstrap Overview Complete 2025-11
Bootstrap Guide Complete 2025-11
Bootstrap Detection Flow Complete 2025-11
Bootstrap API Complete 2025-11
Source Build Guide Complete 2025-11
Arch Linux Guide Complete 2025-11
Gentoo + Nix Guide Complete 2025-11
Build Flow Complete 2025-11
Container Builds Complete 2025-11
Binary Cache Complete 2025-11
Remote Cache Complete 2025-11
Automatic Updates Complete 2025-11
Recipe Authoring Complete 2025-11
Build Binaries Complete 2025-11

Summary

The documentation is organized to help you:

  1. Get started quickly - Follow the getting started guide
  2. Learn by doing - Practical examples throughout
  3. Understand deeply - Detailed explanations when needed
  4. Reference easily - Quick lookup for specific topics

Start with Getting Started and explore from there!