"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.
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 42The 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 bundledx86_64.xmlinstruction spec).frontend/: High-level components (Syntax parser, toy language compiler).lib/: Standalone Nix library (lib.nix) using only custombuiltins.tests/: Unit tests for individual components.
A standalone standard library implemented entirely using only Nix builtins. It replaces all functionality normally provided by nixpkgs.lib.
A bundled static binary of BusyBox used as the builder for the Nix derivation, providing a minimal set of utilities (printf, chmod).
- 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.