1{
2 rustPlatform,
3 fetchFromGitHub,
4 fetchpatch,
5 pkg-config,
6 lib,
7 udev,
8 udevCheckHook,
9 nix-update-script,
10 versionCheckHook,
11}:
12rustPlatform.buildRustPackage rec {
13 pname = "rust-streamdeck";
14 version = "0.9.0";
15
16 src = fetchFromGitHub {
17 owner = "ryankurte";
18 repo = "rust-streamdeck";
19 tag = "v${version}";
20 hash = "sha256-9FuTnRQHKYJzMqhhgyTVq2R+drn4HAr3GDNjQgc3r+w=";
21 };
22
23 cargoPatches = [
24 (fetchpatch {
25 name = "add_cargo_lock.patch";
26 url = "https://github.com/ryankurte/rust-streamdeck/commit/d8497c34898daebafca21885f464f241c29ff9d7.patch";
27 hash = "sha256-cwt4nvtuME//t9KpHgIXHCwLQgpybs2CqV2jO02umfE=";
28 })
29 ];
30
31 cargoHash = "sha256-OiXpG45jwWydbpRHnbIlECOaa75CzUOmdWxZ3WE5+hY=";
32
33 nativeBuildInputs = [
34 pkg-config
35 udevCheckHook
36 ];
37 buildInputs = [ udev ];
38
39 doInstallCheck = true;
40 nativeInstallCheckInputs = [ versionCheckHook ];
41 versionCheckProgram = "${builtins.placeholder "out"}/bin/${meta.mainProgram}";
42
43 postInstall = ''
44 install -Dm444 40-streamdeck.rules -t $out/lib/udev/rules.d/
45 '';
46
47 passthru.updateScript = nix-update-script { };
48
49 meta = {
50 description = "ibusb based driver for Elgato StreamDeck devices";
51 homepage = "https://github.com/ryankurte/rust-streamdeck";
52 license = lib.licenses.mpl20;
53 maintainers = [ lib.maintainers.gdifolco ];
54 mainProgram = "streamdeck-cli";
55 };
56}