com um clique
user-app-development
// Guide for developing, building, and running Nanvix user-space applications across supported runtimes and languages. Use this when asked about guest app implementation or execution.
// Guide for developing, building, and running Nanvix user-space applications across supported runtimes and languages. Use this when asked about guest app implementation or execution.
Guide for Nanvix CI and GitHub Actions workflow behavior, including local pipeline execution and matrix coverage. Use this when asked about CI checks, workflow failures, or release flow.
Guide for creating and modifying Nanvix libraries under src/libs, including guest no_std and host std crates. Use this when asked about library architecture or crate changes.
Guide for developing and debugging Nanvix daemons, including guest daemons and host linuxd behavior. Use this when asked about daemon architecture or daemon changes.
Guide for modifying and debugging the Nanvix kernel architecture and kernel-call paths. Use this when asked about kernel internals or kernel implementation changes.
Guide for writing, running, and debugging Nanvix unit, integration, and system tests in Rust and C/C++. Use this when asked about test implementation or failures.
Guide for running Nanvix tests with z. Use this when asked to run unit tests, integration tests, or the full test suite.
| name | user-app-development |
| description | Guide for developing, building, and running Nanvix user-space applications across supported runtimes and languages. Use this when asked about guest app implementation or execution. |
Use this skill when the user asks about developing, building, or running user-space applications on Nanvix. User applications are programs that run inside the Nanvix guest environment.
| Application | Path | Lang | Runtime |
|---|---|---|---|
hello-rust-nostd | src/user/hello-rust-nostd/ | Rust | Bare-metal |
# Run a native application with console output.
./bin/nanvixd.elf \
-console-file /dev/stdout \
-- ./bin/hello-rust-nostd.elf
# Pass arguments to the application.
./bin/nanvixd.elf \
-console-file /dev/stdout \
-- ./bin/echo-rust-nostd.elf arg1 arg2
# Pass arguments and environment variables.
./bin/nanvixd.elf \
-console-file /dev/stdout \
-- ./bin/echo-rust-nostd.elf \
"arg1 arg2;VAR1=foo VAR2=bar"
# Pass arguments, environment variables, and kernel arguments.
# Format: "<app args>;<env vars>;<kernel args>"
./bin/nanvixd.elf \
-console-file /dev/stdout \
-- ./bin/echo-rust-nostd.elf \
"arg1 arg2;VAR1=foo;feature1 feature2"
# Start nanvixd in HTTP mode.
NANVIX_HTTP_ADDR=127.0.0.1:8080
./bin/nanvixd.elf -http-addr $NANVIX_HTTP_ADDR
# Spawn an application via HTTP (in another terminal).
curl --silent \
--header "Content-Type: application/json" \
--header "X-NVX-Message-Type: NEW" \
--request POST \
--data '{"tenant_id":"foo",
"app_name":"bar",
"program":"./bin/hello-rust-nostd.elf",
"program_args":""}' \
http://${NANVIX_HTTP_ADDR}
./bin/uservm.elf \
-kernel ./bin/kernel.elf \
-initrd ./bin/hello-rust-nostd.elf \
-standalone
On Windows, nanvixd supports standalone interactive mode (no HTTP mode). Both nanvixd and the
UserVM are built natively with the WHP backend:
# Run via nanvixd (recommended).
.\bin\nanvixd.exe -- .\bin\hello-rust-nostd.elf
You can also launch a run via z.ps1:
# Run with default options.
.\z.ps1 run
# Run with a custom guest binary.
.\z.ps1 run -- -program bin\hello-rust-nostd.elf
For low-level debugging, the standalone UserVM is still available:
.\bin\uservm.exe -kernel .\bin\kernel.elf -initrd .\bin\hello-rust-nostd.elf -standalone
Note: HTTP mode is Linux-only. On Windows, only standalone interactive mode via
nanvixdis supported.
Create directory at src/user/<name>/.
Add Cargo.toml:
[package]
name = "<name>"
version.workspace = true
license-file.workspace = true
authors.workspace = true
edition.workspace = true
[[bin]]
name = "<name>"
path = "src/main.rs"
[dependencies]
nvx = { workspace = true }
sys = { workspace = true }
syslog = { workspace = true }
Create src/main.rs:
// Copyright(c) The Maintainers of Nanvix.
// Licensed under the MIT License.
#![no_std]
#![no_main]
extern crate alloc;
// Application entry point.
Add to workspace members in root Cargo.toml.
Add to ALL_GUEST_APPLICATIONS in the Makefile.
src/user/<name>/.Makefile following the pattern in existing C applications.#include <nanvix/...>).libposix.a, libc.a, and the custom linker script at
build/user/linker/x86/user.ld.RUST_LOG environment variable for nanvixd daemon-level logging.syslog crate (error!, warn!, info!, debug!, trace!).logs/ directory; use -console-file /dev/stdout to redirect to
terminal.