From-scratch · x86_64 · long mode

NyxOS

A 64-bit operating system written from scratch in C and x86_64 Assembly — preemptive multitasking, a windowed desktop, a real TCP/IP stack, and an EXT2 filesystem. No libraries. Just the metal.

◆ v5.7.20 GPL-2.0+ 0 build warnings
nyx:root — terminal
x86_64long mode · 4-level paging
C + NASMzero external libraries
🌙 Nyx Cnative language runtime
40+shell commands
TCP/IPDHCP · DNS · HTTP
32 windowscompositor + taskbar
EXT2read / write, auto-mount
Overview

An operating system you can read end to end

NyxOS boots via Multiboot2 (GRUB-compatible), enters long mode with 4-level paging, and provides a clean foundation for kernel development: a preemptive scheduler, ring-3 userspace with ELF64 and syscalls, a windowed GUI, and a from-scratch network stack — all built up one honest, verified increment at a time.

NyxOS Desktop · window compositor
The NyxOS desktop: wallpaper, app icons, windows and a taskbar
Features

What's inside the kernel

Every subsystem is written from scratch and verified in QEMU.

Boot & initialization

Multiboot2, x86_64 long mode, GDT/IDT with a full exception set, PIT at 1000 Hz, Local + I/O APIC, and PS/2 keyboard & mouse drivers.

Memory management

Bitmap physical allocator, a 16 MB kernel heap, 4-level paging with a higher-half mapping, per-process page tables, and NX + SMEP hardening.

Processes & scheduler

Preemptive weighted round-robin over kernel threads and ring-3 processes, with full shell job control — exec, spawn, jobs, wait, kill, nice.

ELF userspace

An ELF64 loader, an embedded initramfs, fork() with copy-on-write, 10 syscalls via syscall/sysret, a minimal libc, isolated per-process file descriptors, and the 🌙 Nyx C language runtime for first-class userspace programming.

Shell

40+ built-in commands with Tab completion, environment-variable expansion, command history, output redirection, and pipes.

🖧

Networking

RTL8139 driver, ARP/IPv4/UDP/ICMP/DHCP/DNS, and a full TCP stack: retransmission with RTO, passive open (listen/accept), loopback, and an HTTP client & server.

🗔

GUI compositor

Up to 32 windows with z-ordering, drag & resize, four workspaces, a taskbar and Start menu — plus a Terminal, File Manager, Editor, Paint and more.

🖴

Filesystem

A ramdisk VFS with an EXT2 read/write driver auto-mounted at /mnt, per-fd byte offsets, and persistence across reboots on a disk image.

Multimedia

A Bochs VBE framebuffer (1024×768×32), a Sound Blaster 16 driver (DMA + IRQ + mixer), PC-speaker tones, and a DOOM port with sound.

Architecture

How it fits together

A higher-half kernel, isolated user address spaces, and an interrupt-driven core.

Boot flow

  1. GRUB / Multiboot2 hands off with a memory map + framebuffer.
  2. Long mode — GDT, 64-bit code/data, TSS, IDT with IST stacks.
  3. Paging — identity-map low memory, mirror the kernel into the higher half.
  4. Drivers — PIT, APIC, PS/2, RTL8139, ATA/EXT2, VBE, SB16.
  5. Login — PBKDF2-hashed credentials (nyx / nyx).
  6. Desktop — the window compositor launches as a scheduled process.

Memory layout

0xFFFFFF80_00000000Higher-half kernel (PML4[511])
0x00000000_00100000Kernel linked low (1 MB)
user halfPer-process, isolated (no identity map)
NX + SMEPUser pages non-exec; kernel can't run user code

Interrupt core

The PIT (ISA IRQ0) is routed via the I/O APIC on pin 2 → vector 32, driving a 1000 Hz tick. The scheduler preempts on that tick; syscalls and IRQs switch CR3 on entry so each process sees only its own address space.

Manual

Getting started

Build the kernel, boot it in QEMU, and log in.

1

Clone & build

bash · Linux / WSL
# cross-compiler (x86_64-elf-gcc) or host gcc -m64
git clone https://github.com/kazah-png/nyx-os.git
cd nyx-os
make -C kernel        # → kernel/nyx-kernel.bin
PowerShell · Windows
.\build.ps1           # WSL cross-compile → kernel + bootable ISO
2

Run in QEMU

bash
# GUI desktop + networking + disk
qemu-system-x86_64 -cdrom NyxOS.iso -m 256M -no-reboot \
  -hda ext2-test.img -nic user,model=rtl8139 -display sdl

Serve HTTP from the guest by forwarding a host port: add hostfwd=tcp::8080-:80 to the NIC, run tcpserve 80, then curl localhost:8080.

3

Log in

The boot animation leads to a framebuffer login screen. The default account is nyx / nyx (PBKDF2-HMAC-SHA256). On success, the NyxOS Desktop launches; with no disk, it falls back to a text shell.

Command reference

The built-in shell — also available in the Terminal window.

CategoryCommands
Systemhelp clear nyxfetch uname date version reboot history env export
Filesls cd pwd cat touch mkdir rm cp mv head tail grep sort wc find tree write which diff hexdump
Processesps mem exec spawn jobs wait kill nice renice usertest
Networkifconfig dhcp ping setip httpget tcptest tcpdrop tcploop tcpserve
Filesystemmount · EXT2 auto-mounts at /mnt
Graphics & soundgui desktop mode fonttest beep play sb16play
Networking

A real TCP/IP stack

From the NIC driver up to an HTTP server — every layer written and debugged from the wire.

HTTP · DNSclient & server
TCPretransmit (RTO) · listen/accept · loopback
UDP · ICMPdatagrams · echo (ping) with RTT
IPv4checksum · routing · loopback delivery
ARP · Ethernetcache · frames
RTL8139PCI NIC · TX/RX rings

Highlights

  • DHCP client — DISCOVER → OFFER → REQUEST → ACK, auto-configures IP, netmask & gateway.
  • ping with statistics — real round-trip timing, per-packet sequencing, and a min/avg/max + loss summary. NyxOS also answers echo requests.
  • TCP retransmission — each connection buffers its outstanding segment and resends it on an RTO with exponential backoff; a lost SYN or data segment recovers automatically.
  • Passive openlisten/accept spawn per-client connections. tcpserve answers a real curl from the host with HTTP/1.1 200 OK.
  • Loopback — a self-contained 127.0.0.1 path lets the whole stack be tested in-guest (tcploop, ping 127.0.0.1).
Releases

The road so far

Selected milestones from a from-scratch kernel to a networked desktop OS.

v1.x

Foundations

Base kernel, ramdisk VFS + shell commands, and the first real networking (RTL8139, ARP/IP/UDP/ICMP).

v2.x

Multitasking, GUI & disks

Preemptive multitasking, a full TCP stack, the window compositor, PC-speaker audio, EXT2 read support, and a Sound Blaster 16 driver.

v3.x

Userspace

ELF loader, initramfs, per-process paging, ring-3 execution, syscalls, an RTC driver and a minimal libc.

v4.x

64-bit & hardening

Full x86_64 long mode, higher-half kernel, user/kernel page-table isolation, and NX + SMEP with APIC init.

v5.0–5.6

Apps, login & ring-3

A full GUI app suite, a boot animation + login screen, security hardening of the syscall boundary, and ring-3 userspace that actually runs.

v5.7.x

Scheduler & the network arc

Preemptive scheduling with job control & nice, per-process fds, drag-and-drop in the File Manager, and a networking sprint: loopback + ICMP, TCP retransmission, multi-segment receive, passive open, and an HTTP server that answers real clients.

v5.8.0

🌙 Nyx C language runtime

Nyx C — a Go/Zig-inspired typed subset of C that transpiles to C and links against the nyxrt runtime. The first .nyx program prints "hola desde nyx c! pid=5" via string interpolation and direct syscalls.

v5.8.1

waitpid(): fork is complete

SYS_WAITPID (11) — a ring-3 parent reaps its children and collects their exit codes.

v5.8.3

Anonymous pipes & blocking IPC

pipe() (SYS_PIPE, 12) with kernel ring buffers, reference-counted ends, and blocking read() — real cross-process IPC. Per-process syscall stacks enable true blocking in ring 0. Current: v5.8.3.

Follow the build

NyxOS is developed in the open, one verified increment at a time. Join the Discord for kernel-dev chat, or dive into the source and status report on GitHub.