MU
muhammad-fiaz/NanoOS
A 64-bit UEFI-only operating system written in Zig.
NanoOS
A 64-bit UEFI-only operating system written in Zig.
Requirements
- Zig: Version 0.15.x or later (Master branch recommended).
- QEMU: For emulation and testing.
- Docker: For containerized building and running (optional but recommended).
Building & Running
Using Docker (Recommended)
-
Build the Docker Image:
docker build -t nanoos . -
Run with QEMU:
- Linux:
docker run -it --rm -v $(pwd):/app -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix nanoos
- Windows (PowerShell):
- Requires an X Server (like VcXsrv) running on Windows.
- Set Display number to 0.
docker run -it --rm -v ${PWD}:/app -e DISPLAY=host.docker.internal:0.0 nanoos
- Linux:
Running Locally on Windows
-
Prerequisites:
- Zig: Installed and in PATH.
- QEMU: Installed and in PATH (or
C:\Program Files\qemu). - OVMF:
OVMF.fdfile placed in the project directory.
-
Run:
- PowerShell:
.\scripts\run_local.ps1 - CMD:
.\scripts\run.bat - Linux:
./scripts/run.sh
- PowerShell:
Manual Build
-
Build:
zig build
-
Run in QEMU:
Ensureqemu-system-x86_64andOVMF.fdare in your PATH or current directory.qemu-system-x86_64 -bios OVMF.fd -drive format=raw,file=fat:rw:zig-out -net none -serial stdio
Architecture
NanoOS uses a layered architecture:
- UEFI Layer: The OS boots as a UEFI application. It uses UEFI Boot Services to locate hardware (Graphics, Input).
- HAL (Hardware Abstraction Layer): Wraps raw UEFI protocols into easy-to-use Zig structs (e.g.,
FrameBuffer). - GUI Engine: Provides high-level drawing capabilities on top of the HAL.
- Kernel/Desktop: The main loop that manages the UI and handles user input.
Features
- UEFI Boot: Boots directly from firmware.
- Graphics: High-resolution framebuffer with 32-bit color.
- Desktop: Simple window manager with a Taskbar, Icons, and Windows.
- Apps: Terminal, File Manager, Calculator, Editor, Sound Recorder.
- Input: Mouse and Keyboard support.
On this page
Languages
Zig99.8%Python0.1%PowerShell0.0%Dockerfile0.0%Shell0.0%Batchfile0.0%
Contributors
GNU General Public License v3.0
Created November 25, 2025
Updated November 26, 2025