Skip to content

jhhuh/bootstrap-nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nix-Bootstrap: A Zero-Dependency x86_64 Pipeline in Pure Nix

"Bootstrapping a simple compiler from nothing, achieving 100% isolation."

This project is a functional implementation of an x86_64 compiler pipeline written entirely in the Nix expression language. It is designed to be truly standalone, with zero external flake inputs and zero dependency on nixpkgs at evaluation or build time.

🚀 Quick Start

Ensure you have Nix installed.

# Clone the repository
git clone <repo-url>
cd bootstrap-nix

# Build the project (No network access required!)
nix build

# Run the resulting binary (Linux x86_64 required)
./result
echo "Exit code: $?" # Should output 42

🏗️ Project Structure

The repository is organized into logical subdirectories for better modularity:

  • bin/: Bundled static binaries (e.g., busybox-static) used in the build sandbox.
  • core/: The heart of the pipeline (Instruction encoder, ELF generator, XML parser).
  • data/: Static resource files (e.g., the bundled x86_64.xml instruction spec).
  • frontend/: High-level components (Syntax parser, toy language compiler).
  • lib/: Standalone Nix library (lib.nix) using only custom builtins.
  • tests/: Unit tests for individual components.

🧩 Zero-Dependency Components

lib/lib.nix

A standalone standard library implemented entirely using only Nix builtins. It replaces all functionality normally provided by nixpkgs.lib.

bin/busybox-static

A bundled static binary of BusyBox used as the builder for the Nix derivation, providing a minimal set of utilities (printf, chmod).

📈 Future Steps

  • Self-hosting: Rewriting the compiler in the toy language.
  • More robust BusyBox integration for complex build tasks.

Created as a demonstration of Advanced Agentic Coding.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published