Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 50 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ edition = "2021"
description = "A Hyperlight VMM wrapper with out-of-the-box support for running Nanvix microkernel guests"

[dependencies]
nanvix = { git = "https://github.com/nanvix/nanvix", rev = "7752e9f2deb4a5606f9885e4c130eec4ea583de1", features = [
nanvix = { git = "https://github.com/nanvix/nanvix", rev = "cc9c508918bd17678e9d790f10a6a7c20b7902da", features = [
"single-process",
"hyperlight",
] }
tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] }
anyhow = "1.0"
clap = { version = "4", features = ["derive"] }
dirs = "6"
libc = "0.2.178"

# NAPI bindings (optional)
Expand Down
25 changes: 11 additions & 14 deletions src/bin/hyperlight-nanvix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use anyhow::Result;
use clap::{Parser, Subcommand};
use hyperlight_nanvix::{cache, RuntimeConfig, Sandbox};
use nanvix::log;
use nanvix::registry::Registry;
use std::path::PathBuf;

/// A Hyperlight VMM wrapper with out-of-the-box support for running Nanvix microkernel guests
Expand Down Expand Up @@ -39,42 +38,40 @@ const DEFAULT_LOG_LEVEL: &str = "info";
async fn setup_registry_command() -> Result<()> {
println!("Setting up Nanvix registry...");

// Check cache status first using shared cache utilities
// Check cache status first using local filesystem probes
let kernel_cached = cache::is_binary_cached("kernel.elf");
let qjs_cached = cache::is_binary_cached("qjs");
let python_cached = cache::is_binary_cached("python3");

if kernel_cached && qjs_cached && python_cached {
println!("Registry already set up at ~/.cache/nanvix-registry/");
} else {
// Trigger registry download by requesting key binaries
let registry = Registry::new(None);

// Download missing binaries via get_cached_binary_path (local first, registry fallback)
if !kernel_cached {
print!("Downloading kernel.elf... ");
let _kernel = registry
.get_cached_binary("hyperlight", "single-process", "kernel.elf")
.await?;
cache::get_cached_binary_path("kernel.elf")
.await
.ok_or_else(|| anyhow::anyhow!("Failed to download kernel.elf"))?;
println!("done");
} else {
println!("kernel.elf already cached");
}

if !qjs_cached {
print!("Downloading qjs binary... ");
let _qjs = registry
.get_cached_binary("hyperlight", "single-process", "qjs")
.await?;
cache::get_cached_binary_path("qjs")
.await
.ok_or_else(|| anyhow::anyhow!("Failed to download qjs"))?;
println!("done");
} else {
println!("qjs already cached");
}

if !python_cached {
print!("Downloading python3 binary... ");
let _python = registry
.get_cached_binary("hyperlight", "single-process", "python3")
.await?;
cache::get_cached_binary_path("python3")
.await
.ok_or_else(|| anyhow::anyhow!("Failed to download python3"))?;
println!("done");
} else {
println!("python3 already cached");
Expand Down
Loading