1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 alsa-lib,
8 flatbuffers,
9 libjpeg_turbo,
10 mbedtls,
11 mdns,
12 pipewire,
13 qt6Packages,
14 qmqtt,
15 xz,
16 sdbus-cpp_2,
17 plutovg,
18 lunasvg,
19 nanopb,
20 linalg,
21 stb,
22}:
23
24let
25 inherit (lib)
26 cmakeBool
27 ;
28in
29
30stdenv.mkDerivation rec {
31 pname = "hyperhdr";
32 version = "21.0.0.0";
33
34 src = fetchFromGitHub {
35 owner = "awawa-dev";
36 repo = "HyperHDR";
37 tag = "v${version}";
38 hash = "sha256-CSggawgUPkpeADc8VXs5FA+ubZAtrtTu0qYgIWA0V/c=";
39 };
40
41 nativeBuildInputs = [
42 cmake
43 pkg-config
44 qt6Packages.wrapQtAppsHook
45 ];
46
47 patches = [
48 # Allow completely unvendoring hyperhdr
49 # This can be removed on the next hyperhdr release
50 ./unvendor.patch
51 ];
52
53 postPatch = ''
54 substituteInPlace sources/sound-capture/linux/SoundCaptureLinux.cpp \
55 --replace-fail "libasound.so.2" "${lib.getLib alsa-lib}/lib/libasound.so.2"
56 '';
57
58 cmakeFlags = [
59 "-DPLATFORM=linux"
60 (cmakeBool "USE_SYSTEM_FLATBUFFERS_LIBS" true)
61 (cmakeBool "USE_SYSTEM_LUNASVG_LIBS" true)
62 (cmakeBool "USE_SYSTEM_MBEDTLS_LIBS" true)
63 (cmakeBool "USE_SYSTEM_MQTT_LIBS" true)
64 (cmakeBool "USE_SYSTEM_NANOPB_LIBS" true)
65 (cmakeBool "USE_SYSTEM_SDBUS_CPP_LIBS" true)
66 (cmakeBool "USE_SYSTEM_STB_LIBS" true)
67 ];
68
69 buildInputs = [
70 alsa-lib
71 flatbuffers
72 libjpeg_turbo
73 linalg
74 lunasvg
75 mbedtls
76 mdns
77 nanopb
78 pipewire
79 plutovg
80 qmqtt
81 qt6Packages.qtbase
82 qt6Packages.qtserialport
83 sdbus-cpp_2
84 stb
85 xz
86 ];
87
88 meta = with lib; {
89 description = "Highly optimized open source ambient lighting implementation based on modern digital video and audio stream analysis for Windows, macOS and Linux (x86 and Raspberry Pi / ARM";
90 homepage = "https://github.com/awawa-dev/HyperHDR";
91 changelog = "https://github.com/awawa-dev/HyperHDR/blob/${src.rev}/CHANGELOG.md";
92 license = licenses.mit;
93 maintainers = with maintainers; [
94 hexa
95 eymeric
96 ];
97 mainProgram = "hyperhdr";
98 platforms = platforms.linux;
99 };
100}