1{
2 lib,
3 stdenv,
4 rustPlatform,
5 fetchFromGitHub,
6 installShellFiles,
7 pkg-config,
8 bluez,
9 dbus,
10 libpulseaudio,
11}:
12rustPlatform.buildRustPackage {
13 pname = "earbuds";
14 version = "0.1.9-unstable-2024-06-28";
15
16 src = fetchFromGitHub {
17 owner = "JojiiOfficial";
18 repo = "LiveBudsCli";
19 rev = "df46706e44fa9e7de355b11eab4cc850efe968a3";
20 hash = "sha256-IEor7aZnwCA6Rg2gXIYSQ65hV/jJOKehujOSZnVzVis=";
21 };
22
23 # fix daemon autostart not working
24 patches = [
25 ./fix-daemon.patch
26 ];
27
28 cargoHash = "sha256-Y1pMmWxfXGcEFPj05/BpXQvd199O5l6hJmePNxMQc/Y=";
29
30 nativeBuildInputs = [
31 installShellFiles
32 pkg-config
33 ];
34
35 buildInputs = [
36 bluez
37 dbus
38 libpulseaudio
39 ];
40
41 # package does not contain any tests
42 doCheck = false;
43
44 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
45 installShellCompletion --cmd earbuds \
46 --bash <($out/bin/earbuds --generate bash) \
47 --fish <($out/bin/earbuds --generate fish) \
48 --zsh <($out/bin/earbuds --generate zsh)
49 '';
50
51 meta = {
52 description = "Free CLI tool to control your Galaxy Buds";
53 homepage = "https://github.com/JojiiOfficial/LiveBudsCli";
54 changelog = "https://github.com/JojiiOfficial/LiveBudsCli/releases";
55 license = lib.licenses.gpl3Only;
56 maintainers = with lib.maintainers; [ griffi-gh ];
57 mainProgram = "earbuds";
58 platforms = lib.platforms.linux;
59 };
60}