nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, pkg-config
6, pcre
7, tinyxml
8, libusb1
9, libzip
10, glib
11, gobject-introspection
12, gst_all_1
13, libwebcam
14, libunwind
15, elfutils
16, orc
17, python3Packages
18, libuuid
19, wrapGAppsHook
20, catch2
21}:
22
23stdenv.mkDerivation rec {
24 pname = "tiscamera";
25 version = "0.13.1";
26
27 src = fetchFromGitHub {
28 owner = "TheImagingSource";
29 repo = pname;
30 rev = "v-${pname}-${version}";
31 sha256 = "0hpy9yhc4mn6w8gvzwif703smmcys0j2jqbz2xfghqxcyb0ykplj";
32 };
33
34 postPatch = ''
35 cp ${catch2}/include/catch2/catch.hpp external/catch/catch.hpp
36 '';
37
38 nativeBuildInputs = [
39 cmake
40 pkg-config
41 python3Packages.wrapPython
42 wrapGAppsHook
43 ];
44
45 buildInputs = [
46 pcre
47 tinyxml
48 libusb1
49 libzip
50 glib
51 gobject-introspection
52 gst_all_1.gstreamer
53 gst_all_1.gst-plugins-base
54 libwebcam
55 libunwind
56 elfutils
57 orc
58 libuuid
59 python3Packages.python
60 python3Packages.pyqt5
61 ];
62
63 pythonPath = with python3Packages; [ pyqt5 pygobject3 ];
64
65 propagatedBuildInputs = pythonPath;
66
67 cmakeFlags = [
68 "-DBUILD_ARAVIS=OFF" # For GigE support. Won't need it as our camera is usb.
69 "-DBUILD_GST_1_0=ON"
70 "-DBUILD_TOOLS=ON"
71 "-DBUILD_V4L2=ON"
72 "-DBUILD_LIBUSB=ON"
73 "-DBUILD_TESTS=ON"
74 "-DTCAM_INSTALL_UDEV=${placeholder "out"}/lib/udev/rules.d"
75 "-DTCAM_INSTALL_UVCDYNCTRL=${placeholder "out"}/share/uvcdynctrl/data/199e"
76 "-DTCAM_INSTALL_GST_1_0=${placeholder "out"}/lib/gstreamer-1.0"
77 "-DTCAM_INSTALL_GIR=${placeholder "out"}/share/gir-1.0"
78 "-DTCAM_INSTALL_TYPELIB=${placeholder "out"}/lib/girepository-1.0"
79 "-DTCAM_INSTALL_SYSTEMD=${placeholder "out"}/etc/systemd/system"
80 "-DTCAM_INSTALL_PYTHON3_MODULES=${placeholder "out"}/lib/${python3Packages.python.libPrefix}/site-packages"
81 "-DGSTREAMER_1.0_INCLUDEDIR=${placeholder "out"}/include/gstreamer-1.0"
82 # There are gobject introspection commands launched as part of the build. Those have a runtime
83 # dependency on `libtcam` (which itself is built as part of this build). In order to allow
84 # that, we set the dynamic linker's path to point on the build time location of the library.
85 "-DCMAKE_SKIP_BUILD_RPATH=OFF"
86 ];
87
88 doCheck = true;
89
90 # gstreamer tests requires, besides gst-plugins-bad, plugins installed by this expression.
91 checkPhase = "ctest --force-new-ctest-process -E gstreamer";
92
93 postFixup = ''
94 wrapPythonPrograms "$out $pythonPath"
95 '';
96
97 meta = with lib; {
98 description = "The Linux sources and UVC firmwares for The Imaging Source cameras";
99 homepage = "https://github.com/TheImagingSource/tiscamera";
100 license = with licenses; [ asl20 ];
101 platforms = platforms.linux;
102 maintainers = with maintainers; [ jraygauthier ];
103 };
104}