{ description = "PixelPass — P2P screen sharing CLI over iroh"; # Same channel the hosts run (nixos-config tracks nixos-26.05). The capture # path talks to the live PipeWire daemon and the system PulseAudio server, so # the client libraries here should come from the same release the server did. inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05"; outputs = { nixpkgs, ... }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; # GStreamer is driven as a SUBPROCESS (gst-launch-1.0 / gst-inspect-1.0), # not linked — there is no gstreamer-sys in Cargo.lock. So these are PATH # dependencies at runtime rather than build inputs, and `deps.rs` refuses # to start a share if any are missing. gstPlugins = with pkgs; [ gst_all_1.gstreamer # gst-launch-1.0 / gst-inspect-1.0 gst_all_1.gst-plugins-base # videoscale (quality-preset downscale) gst_all_1.gst-plugins-good # pulsesrc, ximagesrc gst_all_1.gst-plugins-bad # h264parse, mpegtsmux, aacparse, vah264enc gst_all_1.gst-plugins-ugly # x264enc (software-encode fallback) gst_all_1.gst-libav # avenc_aac pipewire # pipewiresrc (Wayland capture; ships in this pkg) ]; # Opened with dlopen by the optional `--gui` front end (eframe/egui_glow/ # winit/glutin), never linked. Harmless for the default headless build. guiRuntimeLibs = with pkgs; [ libGL libxkbcommon wayland libx11 libxcursor libxrandr libxi ]; in { devShells.${system}.default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ rustc cargo rustfmt clippy # Debian packaging (`cargo deb --no-build`). Build the binary # inside a Debian/Ubuntu distrobox first so it links that distro's # glibc — see the packaging notes in Cargo.toml. cargo-deb pkg-config # pipewire-sys, libspa-sys and libpulse-sys all generate bindings # with bindgen, which needs a real libclang at build time. clang ] ++ gstPlugins ++ [ # The rest of what `deps::check_host_binaries` looks for. pkgs.pulseaudio # `pactl` (PipeWire stays the actual audio server) pkgs.mpv # the viewer-side player pkgs.xwininfo # the `--window` click-picker on X11 # `--doctor` shells out to vainfo to confirm the VA-API H.264 # ENCODE entrypoint really exists. Without it the report can only # say "vah264enc and a render node are present" and has to leave # hardware encode unconfirmed — which matters, because a GPU # missing that entrypoint produces no video at all under the # default encoder rather than failing loudly. pkgs.libva-utils ]; buildInputs = with pkgs; [ pipewire # pipewire-sys + libspa-sys libpulseaudio # libpulse-sys: --repair reads/unloads Pulse modules # x11rb is declared `default-features = false` here, which by itself # is pure Rust — but Cargo unifies features across the graph, and # arboard pulls x11rb with its `libxcb` feature on. That drags in # as-raw-xcb-connection and makes the final link need -lxcb. It is a # real link-time dependency of the binary, not an optional extra. libxcb ] ++ guiRuntimeLibs; # bindgen finds libclang through this variable specifically — having # clang on PATH is not sufficient. LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib"; # NixOS keeps every GStreamer plugin in its own store path, so # gst-launch-1.0 discovers them ONLY through this search path. Without # it, pixelpass's `gst-inspect-1.0 --exists pipewiresrc` preflight fails # even though the plugins are installed. Same reasoning as the # GST_PLUGIN_SYSTEM_PATH_1_0 block in nixos-config hosts/darp5. GST_PLUGIN_SYSTEM_PATH_1_0 = pkgs.lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" gstPlugins; LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath guiRuntimeLibs; # Only greet an interactive shell. shellHook also runs under # `nix develop --command …`, where printing this would interleave the # banner with the command's own output (and corrupt it outright for # anything whose stdout is parsed, such as pixelpass's `--output json`). shellHook = '' if [ -t 1 ]; then echo "pixelpass — rustc $(rustc --version | cut -d' ' -f2) / cargo $(cargo --version | cut -d' ' -f2)" echo " cargo build --release headless build (what peerspeak spawns)" echo " cargo build --release --features gui with the egui front end" echo " cargo test unit + integration tests" echo " ./target/debug/pixelpass --doctor verify this machine can host" echo echo "GStreamer, pactl, mpv and xwininfo are on PATH in this shell, so" echo "capture works here without a system rebuild." fi ''; }; }; }