{ lib, rustPlatform, pkg-config, makeWrapper, autoPatchelfHook, dbus, libpulseaudio, wayland, libxkbcommon, libGL, expat, fontconfig, freetype, makeDesktopItem, copyDesktopItems, namespace, system, pkgs, }: let inherit (lib.trivial) importJSON; inherit (lib.${namespace}) selectVariant mkAllSources; versionSpec = importJSON ./version.json; selected = selectVariant versionSpec null null; sources = mkAllSources pkgs selected; # cargoHash is stored alongside the source in version.json so the TUI can update it cargoHash = selected.sources.librepods.cargoHash; in rustPlatform.buildRustPackage rec { pname = "librepods"; version = "0.1.0-${system}"; src = sources.librepods; sourceRoot = "${src.name}/linux-rust"; inherit cargoHash; nativeBuildInputs = [ pkg-config libpulseaudio autoPatchelfHook makeWrapper copyDesktopItems ]; buildInputs = [ dbus libpulseaudio wayland expat fontconfig freetype freetype.dev libGL pkg-config # libx11 # libXcursor # libXi # libXandr wayland libxkbcommon ]; desktopItem = makeDesktopItem { name = "librepods"; desktopName = "LibrePODS"; comment = "Open source alternative for AirPods"; exec = "librepods"; icon = "librepods"; terminal = false; categories = [ "Audio" "Utility" ]; }; postFixup = '' wrapProgram $out/bin/librepods --suffix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} ''; passthru.imaging = desktopItem; meta = with lib; { description = "Open source alternative for AirPods"; homepage = "https://github.com/kavishdevar/librepods"; license = licenses.gpl3; maintainers = [ ]; mainProgram = "librepods"; platforms = platforms.linux; }; }