nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 runtimeShell,
8 catch2,
9 elfutils,
10 libselinux,
11 libsepol,
12 libunwind,
13 libusb1,
14 libuuid,
15 libzip,
16 orc,
17 pcre,
18 zstd,
19 glib,
20 gobject-introspection,
21 gst_all_1,
22 wrapGAppsHook3,
23 # needs pkg_resources
24 withDoc ? false,
25 sphinx,
26 graphviz,
27 withAravis ? true,
28 aravis,
29 meson,
30 withAravisUsbVision ? withAravis,
31 withGui ? true,
32 qt5,
33}:
34
35stdenv.mkDerivation rec {
36 pname = "tiscamera";
37 version = "1.1.1";
38
39 src = fetchFromGitHub {
40 owner = "TheImagingSource";
41 repo = "tiscamera";
42 rev = "v-tiscamera-${version}";
43 hash = "sha256-33U/8CbqNWIRwfDHXCZSN466WEQj9fip+Z5EJ7kIwRM=";
44 };
45
46 postPatch = ''
47 cp ${catch2}/include/catch2/catch.hpp external/catch/catch.hpp
48
49 substituteInPlace ./data/udev/80-theimagingsource-cameras.rules.in \
50 --replace "/bin/sh" "${runtimeShell}/bin/sh" \
51 --replace "typically /usr/bin/" "" \
52 --replace "typically /usr/share/theimagingsource/tiscamera/uvc-extension/" ""
53 '';
54
55 nativeBuildInputs = [
56 cmake
57 pkg-config
58 wrapGAppsHook3
59 gobject-introspection
60 ]
61 ++ lib.optionals withDoc [
62 sphinx
63 graphviz
64 ]
65 ++ lib.optionals withAravis [
66 meson
67 ]
68 ++ lib.optionals withGui [
69 qt5.wrapQtAppsHook
70 ];
71
72 buildInputs = [
73 elfutils
74 libselinux
75 libsepol
76 libunwind
77 libusb1
78 libuuid
79 libzip
80 orc
81 pcre
82 zstd
83 glib
84 gst_all_1.gstreamer
85 gst_all_1.gst-plugins-base
86 gst_all_1.gst-plugins-good
87 gst_all_1.gst-plugins-bad
88 gst_all_1.gst-plugins-ugly
89 ]
90 ++ lib.optionals withAravis [
91 aravis
92 ]
93 ++ lib.optionals withGui [
94 qt5.qtbase
95 ];
96
97 hardeningDisable = [ "format" ];
98
99 cmakeFlags = [
100 "-DTCAM_BUILD_GST_1_0=ON"
101 "-DTCAM_BUILD_TOOLS=ON"
102 "-DTCAM_BUILD_V4L2=ON"
103 "-DTCAM_BUILD_LIBUSB=ON"
104 "-DTCAM_BUILD_TESTS=ON"
105 "-DTCAM_BUILD_ARAVIS=${if withAravis then "ON" else "OFF"}"
106 "-DTCAM_BUILD_DOCUMENTATION=${if withDoc then "ON" else "OFF"}"
107 "-DTCAM_BUILD_WITH_GUI=${if withGui then "ON" else "OFF"}"
108 "-DTCAM_DOWNLOAD_MESON=OFF"
109 "-DTCAM_INTERNAL_ARAVIS=OFF"
110 "-DTCAM_ARAVIS_USB_VISION=${if withAravis && withAravisUsbVision then "ON" else "OFF"}"
111 "-DTCAM_INSTALL_FORCE_PREFIX=ON"
112 ];
113
114 env.CXXFLAGS = "-include cstdint";
115
116 doCheck = true;
117
118 # gstreamer tests requires, besides gst-plugins-bad, plugins installed by this expression.
119 checkPhase = "ctest --force-new-ctest-process -E gstreamer";
120
121 # wrapGAppsHook3: make sure we add ourselves to the introspection
122 # and gstreamer paths.
123 GI_TYPELIB_PATH = "${placeholder "out"}/lib/girepository-1.0";
124 GST_PLUGIN_SYSTEM_PATH_1_0 = "${placeholder "out"}/lib/gstreamer-1.0";
125
126 QT_PLUGIN_PATH = lib.optionalString withGui "${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}";
127
128 dontWrapQtApps = true;
129
130 doInstallCheck = true;
131
132 preFixup = ''
133 gappsWrapperArgs+=("''${qtWrapperArgs[@]}")
134 '';
135
136 meta = with lib; {
137 description = "Linux sources and UVC firmwares for The Imaging Source cameras";
138 homepage = "https://github.com/TheImagingSource/tiscamera";
139 license = with licenses; [ asl20 ];
140 platforms = platforms.linux;
141 maintainers = with maintainers; [ jraygauthier ];
142 };
143}