1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 cmake,
6 wrapQtAppsHook,
7 perl,
8 flatbuffers,
9 protobuf,
10 mbedtls,
11 alsa-lib,
12 hidapi,
13 libcec,
14 libusb1,
15 libX11,
16 libxcb,
17 libXrandr,
18 python3,
19 qtbase,
20 qtserialport,
21 qtsvg,
22 qtx11extras,
23 withRPiDispmanx ? false,
24 libraspberrypi,
25}:
26
27stdenv.mkDerivation rec {
28 pname = "hyperion.ng";
29 version = "2.0.16";
30
31 src = fetchFromGitHub {
32 owner = "hyperion-project";
33 repo = pname;
34 rev = version;
35 hash = "sha256-nQPtJw9DOKMPGI5trxZxpP+z2PYsbRKqOQEyaGzvmmA=";
36 # needed for `dependencies/external/`:
37 # * rpi_ws281x` - not possible to use as a "system" lib
38 # * qmdnsengine - not in nixpkgs yet
39 fetchSubmodules = true;
40 };
41
42 buildInputs = [
43 alsa-lib
44 hidapi
45 libusb1
46 libX11
47 libxcb
48 libXrandr
49 flatbuffers
50 protobuf
51 mbedtls
52 python3
53 qtbase
54 qtserialport
55 qtsvg
56 qtx11extras
57 ]
58 ++ lib.optional stdenv.hostPlatform.isLinux libcec
59 ++ lib.optional withRPiDispmanx libraspberrypi;
60
61 nativeBuildInputs = [
62 cmake
63 wrapQtAppsHook
64 ]
65 ++ lib.optional stdenv.hostPlatform.isDarwin perl; # for macos bundle
66
67 patchPhase = ''
68 patchShebangs test/testrunner.sh
69 patchShebangs src/hyperiond/CMakeLists.txt
70 '';
71
72 cmakeFlags = [
73 "-DENABLE_DEPLOY_DEPENDENCIES=OFF"
74 "-DUSE_SYSTEM_FLATBUFFERS_LIBS=ON"
75 "-DUSE_SYSTEM_PROTO_LIBS=ON"
76 "-DUSE_SYSTEM_MBEDTLS_LIBS=ON"
77 # "-DUSE_SYSTEM_QMDNS_LIBS=ON" # qmdnsengine not in nixpkgs yet
78 "-DENABLE_TESTS=ON"
79 ]
80 ++ lib.optional (withRPiDispmanx == false) "-DENABLE_DISPMANX=OFF";
81
82 doCheck = true;
83 checkPhase = ''
84 cd ../ && ./test/testrunner.sh && cd -
85 '';
86
87 meta = with lib; {
88 description = "Opensource Bias or Ambient Lighting implementation";
89 homepage = "https://github.com/hyperion-project/hyperion.ng";
90 license = licenses.mit;
91 maintainers = with maintainers; [
92 algram
93 kazenyuk
94 ];
95 platforms = platforms.unix;
96 };
97}