Your first project¶
This is the quickest clean path into Novus.
Create a project with Nox¶
That gives you a starter project with:
nox init already pulls the standard library, so you can start writing code immediately.
The starter file¶
A minimal project usually looks like this:
module my_app;
import lib/std std;
fn main() -> i32 {
std.print("Hello, world!");
std.exit(0);
return 0;
}
What each line means¶
module my_app;gives the file a module name.import lib/std std;imports thestdpackage and aliases it tostd.fn main() -> i32is the entrypoint.std.exit(0)exits the process cleanly.
Compile it¶
You should get output in:
For example on macOS arm64:
Run it:
Add a second function¶
module my_app;
import lib/std std;
fn greet(name: str) -> void {
std.print("Hello " + name);
}
fn main() -> i32 {
greet("Novus");
std.exit(0);
return 0;
}
What libraries.conf does¶
Nox keeps your dependencies in libraries.conf.
Modern projects often contain lines like:
installed=std
pkg:std:source=registry
pkg:std:url=https://github.com/MJDaws0n/novus-std
pkg:std:version=1.3.0
This file is important because it tells Nox:
- which packages are installed
- where they came from
- which version to use
Pull another package¶
That places the package into lib/window/ and updates libraries.conf.
At that point your code can import it:
Common beginner mistakes¶
- Running
novusfrom the wrong directory. - Forgetting to run
nox initfirst. - Editing code while an old
lib/directory is still checked in from a previous package version. - Mixing old and new import styles without checking the package entrypoint.