# 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. The web front-end self-hosts it as # woff2, which Slint cannot read, so the dev shell points Slint at the TTF instead # (`SLINT_DEFAULT_FONT` takes one file and makes it the primary font). Without it # everything still renders, in whatever sans fontconfig hands back. SLINT_DEFAULT_FONT = "${pkgs.nunito}/share/fonts/truetype/Nunito/Nunito[wght].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" ''; }