{
  lib,
  rustPlatform,
  fetchFromGitHub,
  pkg-config,
  makeWrapper,
  autoPatchelfHook,
  dbus,
  libpulseaudio,
  wayland,
  libxkbcommon,
  libGL,
  xorg,
  expat,
  fontconfig,
  freetype,
}:
let
  inherit (lib.trivial) importJSON;
  versions = importJSON ./versions.json;
in
rustPlatform.buildRustPackage rec {
  pname = "librepods";
  version = "0.1.0";

  src = fetchFromGitHub {
    owner = "kavishdevar";
    repo = "librepods";
    rev = versions.rev;
    hash = versions.hash;
  };

  sourceRoot = "${src.name}/linux-rust";

  cargoHash = "sha256-Ebqx+UU2tdygvqvDGjBSxbkmPnkR47/yL3sCVWo54CU=";

  nativeBuildInputs = [
    pkg-config
    libpulseaudio
    autoPatchelfHook
    makeWrapper
  ];

  buildInputs = [
    dbus
    libpulseaudio
    wayland
    expat
    fontconfig
    freetype
    freetype.dev
    libGL
    pkg-config
    xorg.libX11
    xorg.libXcursor
    xorg.libXi
    xorg.libXrandr
    wayland
    libxkbcommon
  ];

  postFixup = ''
    wrapProgram $out/bin/librepods --suffix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs}
  '';

  meta = with lib; {
    description = "Open source alternative for AirPods";
    homepage = "https://github.com/kavishdevar/librepods";
    license = licenses.gpl3;
    maintainers = [ ];
    mainProgram = "librepods";
    platforms = platforms.linux;
  };
}
