# Dev shell for the Slint front-end. # # NixOS has no rustup-installed toolchain here, and Slint's renderers link against # system GL/X11/Wayland libraries that a plain `cargo build` cannot find on its own - # hence LD_LIBRARY_PATH below rather than just a list of buildInputs. { pkgs ? import { } }: let # Everything the winit backend dlopen()s at runtime. Missing one of these shows up # as a panic inside winit, not as a link error, so they are easy to misdiagnose. runtimeLibs = with pkgs; [ libGL libxkbcommon wayland xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr fontconfig freetype ]; in pkgs.mkShell { nativeBuildInputs = with pkgs; [ cargo rustc rustfmt clippy pkg-config # Only needed when building with --features skia: rust-skia compiles its own # bindings shim and wants a C++ toolchain plus python for the GN build. clang python3 ]; # Nunito is the face the design is drawn in. `SLINT_DEFAULT_FONT` takes one file and # makes it the primary font. This points at the copy vendored in `fonts/` rather than # at nixpkgs, so development and the device render from the identical file. SLINT_DEFAULT_FONT = toString ./fonts/Nunito.ttf; buildInputs = runtimeLibs ++ (with pkgs; [ fontconfig # libinput/libdrm/libseat are the linuxkms (kiosk) backend's dependencies. They # cost nothing to have present on a desktop build. libinput libdrm seatd udev ]); LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath runtimeLibs; # rust-skia downloads a prebuilt libskia rather than building it, when it can. SKIA_BINARIES_URL_TEMPLATE = null; shellHook = '' echo "musicmouse slint-frontend — cargo $(cargo --version | cut -d' ' -f2)" echo " cargo run # windowed, femtovg" echo " cargo run --features skia # windowed, skia (what the Pi uses)" echo " cargo build --features kiosk # linuxkms + skia, for the device" ''; }