1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 python3Packages,
7}:
8
9stdenv.mkDerivation rec {
10 pname = "facedetect";
11 version = "0.1";
12
13 src = fetchFromGitHub {
14 owner = "wavexx";
15 repo = "facedetect";
16 rev = "v${version}";
17 sha256 = "0mddh71cjbsngpvjli406ndi2x613y39ydgb8bi4z1jp063865sd";
18 };
19
20 patches = [
21 (fetchpatch {
22 name = "python3-support.patch";
23 url = "https://gitlab.com/wavexx/facedetect/-/commit/8037d4406eb76dd5c106819f72c3562f8b255b5b.patch";
24 sha256 = "1752k37pbkigiwglx99ba9360ahzzrrb65a8d77k3xs4c3bcmk2p";
25 })
26 ];
27
28 buildInputs = [
29 python3Packages.python
30 python3Packages.wrapPython
31 ];
32 pythonPath = [
33 python3Packages.numpy
34 python3Packages.opencv4
35 ];
36
37 dontConfigure = true;
38
39 postPatch = ''
40 substituteInPlace facedetect \
41 --replace /usr/share/opencv "${python3Packages.opencv4}/share/opencv4"
42 '';
43
44 installPhase = ''
45 install -v -m644 -D README.rst $out/share/doc/${pname}-${version}/README.rst
46 install -v -m755 -D facedetect $out/bin/facedetect
47 wrapPythonPrograms
48 '';
49
50 meta = with lib; {
51 homepage = "https://www.thregr.org/~wavexx/software/facedetect/";
52 description = "Simple face detector for batch processing";
53 license = licenses.gpl2Plus;
54 platforms = platforms.all;
55 maintainers = [ maintainers.rycee ];
56 mainProgram = "facedetect";
57 };
58}