- 🌸 Nix
Important
You will need to enable nix-command
and flakes
experimental features
If you get an error about it, consider this command:
mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" | tee ~/.config/nix/nix.conf
Clone this repository and run nix develop
to enter the development environment
git clone https://github.com/Miou-zora/Zaytracer.git
cd Zaytracer
nix develop
zig build -Doptimize=ReleaseFast
# or
nix build
zig build
# It will build the project and run it. (do nothing if the project is already built)
zig build run
# or you can run the executable directly
./zig-out/bin/Zaytracer
./result/bin/Zaytracer
You may load the devShell automatically using direnv shell integration.
echo "use flake" | tee .envrc
direnv allow
If you want to works on the project using codespace, follow these instructions:
I. Create a codespace with current configuration
II. Execute mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" | tee ~/.config/nix/nix.conf
III. Execute eval "$(direnv hook bash)"
for bash or you can find your hook command here
IV. Execute:
echo "use flake" | tee .envrc
direnv allow
To take performance measures you can use th perf tool like this:
perf record -g ./Zaytracer
perf report -g 'graph,0.5,caller'
You will need a debug build for that, else you won't have debug symbols.
You can use the hyperfine tool to measure the time of execution of the program.
If you use nix build
:
hyperfine "./result/bin/Zaytracer" --warmup 10
or if you use zig build -Doptimize=ReleaseFast
:
hyperfine "./zig-out/bin/Zaytracer" --warmup 10