Point the docs at the flake
README's build section described zig, DotSlash and `scripts/`, none of which exist any more, and glimmer-vidya's named a buck2 recipe. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
d682bfa parent: 5ae197f modified
README.md +41 -17 | @@ -39,29 +39,53 @@ than naming one. | ||
| 39 | 39 | |
| 40 | 40 | ## Building |
| 41 | 41 | |
| 42 | +The flake is the toolchain. `nix develop` is where the compiler, the C | |
| 43 | +toolchain, PipeWire's headers and the kernel headers bindgen wants come from, | |
| 44 | +so **nothing needs to be installed** beyond nix itself — no `cc` on PATH, no | |
| 45 | +rustup, no NDK. | |
| 46 | + | |
| 42 | 47 | ```bash |
| 43 | -just build # release .so files in target/release | |
| 44 | -just test # the whole workspace | |
| 45 | -just libdir # where to point LD_LIBRARY_PATH | |
| 48 | +nix develop # then: | |
| 49 | +just build # release .so files in target/release | |
| 50 | +just test # the whole workspace | |
| 51 | +just libdir # where to point LD_LIBRARY_PATH | |
| 46 | 52 | ``` |
| 47 | 53 | |
| 48 | -Everything is compiled by `zig cc`, which brings its own glibc sysroot and | |
| 49 | -Linux headers, so **no system C or C++ toolchain is needed** — this repo builds | |
| 50 | -on a machine with no `cc` on its PATH at all. The pinned tools come from | |
| 51 | -DotSlash files in `scripts/`, fetched on first use; `dotslash` must be on PATH. | |
| 54 | +`just build` is the edit loop; the nix outputs are the artifact, built against | |
| 55 | +a pinned compiler and a pinned crate graph: | |
| 52 | 56 | |
| 53 | -Two things sit outside that promise and are worth knowing about: | |
| 57 | +```bash | |
| 58 | +nix build # all three objects → result/lib | |
| 59 | +nix build .#android # both device objects → result/lib/arm64-v8a | |
| 60 | +nix flake check # fmt, clippy, tests, all three objects | |
| 61 | +``` | |
| 54 | 62 | |
| 55 | -* **bindgen runs libclang directly** and does not inherit zig's header search | |
| 56 | - path, so `v4l2r` cannot find `linux/videodev2.h`. The justfile points it at | |
| 57 | - zig's bundled copies. That is what `scripts/zig-include` is for, and why | |
| 58 | - building through `just` rather than bare `cargo` is the supported path. | |
| 63 | +Two things are worth knowing about: | |
| 64 | + | |
| 65 | +* **bindgen runs libclang directly**, so `v4l2r` needs to be pointed at | |
| 66 | + `linux/videodev2.h`. The flake sets `V4L2R_VIDEODEV2_H_PATH` and | |
| 67 | + `BINDGEN_EXTRA_CLANG_ARGS` from nixpkgs' `linuxHeaders` in both the devShell | |
| 68 | + and the build, which is why building inside `nix develop` rather than a bare | |
| 69 | + shell is the supported path. | |
| 59 | 70 | * **PipeWire** is a real system dependency — `libspa-sys` wants `pkg-config` |
| 60 | - and PipeWire's headers. It is behind the default-on `pipewire` feature of | |
| 61 | - `jolt-moq`; `just test-minimal` builds without it. Turning it off costs | |
| 62 | - device *names*: only ALSA PCMs remain visible ("pipewire", "sysdefault") | |
| 63 | - rather than the real sources a browser would offer, which makes picking a | |
| 64 | - microphone guesswork. | |
| 71 | + and PipeWire's headers, and the flake supplies both. It is behind the | |
| 72 | + default-on `pipewire` feature of `jolt-moq`; `just test-minimal` builds | |
| 73 | + without it, for a machine outside the flake. Turning it off costs device | |
| 74 | + *names*: only ALSA PCMs remain visible ("pipewire", "sysdefault") rather than | |
| 75 | + the real sources a browser would offer, which makes picking a microphone | |
| 76 | + guesswork. | |
| 77 | + | |
| 78 | +### Android | |
| 79 | + | |
| 80 | +```bash | |
| 81 | +just ffi-android # nix build .#android | |
| 82 | +``` | |
| 83 | + | |
| 84 | +Same sources and same `Cargo.lock` as the desktop objects; only the target | |
| 85 | +configuration moves. The NDK comes from nixpkgs, so this needs nothing | |
| 86 | +installed either. The camera wants two things from the APK that the build | |
| 87 | +cannot supply: a `CameraCapture` class in its `classes.dex`, and a call to | |
| 88 | +`joltmoq_android_init` — see `android/jolt_main.c`. | |
| 65 | 89 | |
| 66 | 90 | ## jolt-moq |
| 67 | 91 | |
| @@ -39,29 +39,53 @@ than naming one. | |||
| 39 | 39 | ||
| 40 | ## Building | 40 | ## Building |
| 41 | 41 | ||
| 42 | +The flake is the toolchain. `nix develop` is where the compiler, the C | ||
| 43 | +toolchain, PipeWire's headers and the kernel headers bindgen wants come from, | ||
| 44 | +so **nothing needs to be installed** beyond nix itself — no `cc` on PATH, no | ||
| 45 | +rustup, no NDK. | ||
| 46 | + | ||
| 42 | ```bash | 47 | ```bash |
| 43 | -just build # release .so files in target/release | 48 | +nix develop # then: |
| 44 | -just test # the whole workspace | 49 | +just build # release .so files in target/release |
| 45 | -just libdir # where to point LD_LIBRARY_PATH | 50 | +just test # the whole workspace |
| 51 | +just libdir # where to point LD_LIBRARY_PATH | ||
| 46 | ``` | 52 | ``` |
| 47 | 53 | ||
| 48 | -Everything is compiled by `zig cc`, which brings its own glibc sysroot and | 54 | +`just build` is the edit loop; the nix outputs are the artifact, built against |
| 49 | -Linux headers, so **no system C or C++ toolchain is needed** — this repo builds | 55 | +a pinned compiler and a pinned crate graph: |
| 50 | -on a machine with no `cc` on its PATH at all. The pinned tools come from | ||
| 51 | -DotSlash files in `scripts/`, fetched on first use; `dotslash` must be on PATH. | ||
| 52 | 56 | ||
| 53 | -Two things sit outside that promise and are worth knowing about: | 57 | +```bash |
| 58 | +nix build # all three objects → result/lib | ||
| 59 | +nix build .#android # both device objects → result/lib/arm64-v8a | ||
| 60 | +nix flake check # fmt, clippy, tests, all three objects | ||
| 61 | +``` | ||
| 54 | 62 | ||
| 55 | -* **bindgen runs libclang directly** and does not inherit zig's header search | 63 | +Two things are worth knowing about: |
| 56 | - path, so `v4l2r` cannot find `linux/videodev2.h`. The justfile points it at | 64 | + |
| 57 | - zig's bundled copies. That is what `scripts/zig-include` is for, and why | 65 | +* **bindgen runs libclang directly**, so `v4l2r` needs to be pointed at |
| 58 | - building through `just` rather than bare `cargo` is the supported path. | 66 | + `linux/videodev2.h`. The flake sets `V4L2R_VIDEODEV2_H_PATH` and |
| 67 | + `BINDGEN_EXTRA_CLANG_ARGS` from nixpkgs' `linuxHeaders` in both the devShell | ||
| 68 | + and the build, which is why building inside `nix develop` rather than a bare | ||
| 69 | + shell is the supported path. | ||
| 59 | * **PipeWire** is a real system dependency — `libspa-sys` wants `pkg-config` | 70 | * **PipeWire** is a real system dependency — `libspa-sys` wants `pkg-config` |
| 60 | - and PipeWire's headers. It is behind the default-on `pipewire` feature of | 71 | + and PipeWire's headers, and the flake supplies both. It is behind the |
| 61 | - `jolt-moq`; `just test-minimal` builds without it. Turning it off costs | 72 | + default-on `pipewire` feature of `jolt-moq`; `just test-minimal` builds |
| 62 | - device *names*: only ALSA PCMs remain visible ("pipewire", "sysdefault") | 73 | + without it, for a machine outside the flake. Turning it off costs device |
| 63 | - rather than the real sources a browser would offer, which makes picking a | 74 | + *names*: only ALSA PCMs remain visible ("pipewire", "sysdefault") rather than |
| 64 | - microphone guesswork. | 75 | + the real sources a browser would offer, which makes picking a microphone |
| 76 | + guesswork. | ||
| 77 | + | ||
| 78 | +### Android | ||
| 79 | + | ||
| 80 | +```bash | ||
| 81 | +just ffi-android # nix build .#android | ||
| 82 | +``` | ||
| 83 | + | ||
| 84 | +Same sources and same `Cargo.lock` as the desktop objects; only the target | ||
| 85 | +configuration moves. The NDK comes from nixpkgs, so this needs nothing | ||
| 86 | +installed either. The camera wants two things from the APK that the build | ||
| 87 | +cannot supply: a `CameraCapture` class in its `classes.dex`, and a call to | ||
| 88 | +`joltmoq_android_init` — see `android/jolt_main.c`. | ||
| 65 | 89 | ||
| 66 | ## jolt-moq | 90 | ## jolt-moq |
| 67 | 91 | ||
modified
jolt/glimmer-vidya/README.md +1 -1 | @@ -68,7 +68,7 @@ it on the loop thread. Handlers are held on the jolt side and never sent. | ||
| 68 | 68 | `libvidya` built from [`../ffi`](../ffi), the Rust/egui implementation: |
| 69 | 69 | |
| 70 | 70 | ```sh |
| 71 | -just ffi # buck2 → ../build/libvidya.so | |
| 71 | +just ffi-android # nix build .#android → ../result/lib/arm64-v8a/libvidya.so | |
| 72 | 72 | ``` |
| 73 | 73 | |
| 74 | 74 | Then put it on the search path when running anything here: |
| @@ -68,7 +68,7 @@ it on the loop thread. Handlers are held on the jolt side and never sent. | |||
| 68 | `libvidya` built from [`../ffi`](../ffi), the Rust/egui implementation: | 68 | `libvidya` built from [`../ffi`](../ffi), the Rust/egui implementation: |
| 69 | 69 | ||
| 70 | ```sh | 70 | ```sh |
| 71 | -just ffi # buck2 → ../build/libvidya.so | 71 | +just ffi-android # nix build .#android → ../result/lib/arm64-v8a/libvidya.so |
| 72 | ``` | 72 | ``` |
| 73 | 73 | ||
| 74 | Then put it on the search path when running anything here: | 74 | Then put it on the search path when running anything here: |