From 7a7bf33edf9d9c865fe88e55ad4639e4c9654c96 Mon Sep 17 00:00:00 2001 From: Jussi Kuokkanen Date: Sat, 19 Aug 2023 22:33:32 +0300 Subject: [PATCH] deface: init at 1.4.0 --- pkgs/applications/video/deface/default.nix | 56 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 58 insertions(+) create mode 100644 pkgs/applications/video/deface/default.nix diff --git a/pkgs/applications/video/deface/default.nix b/pkgs/applications/video/deface/default.nix new file mode 100644 index 000000000000..43c009c9dbb8 --- /dev/null +++ b/pkgs/applications/video/deface/default.nix @@ -0,0 +1,56 @@ +{ lib +, stdenv +, python3 +, fetchFromGitHub +, makeWrapper +, pkgs +}: + +python3.pkgs.buildPythonApplication rec { + pname = "deface"; + version = "1.4.0"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "ORB-HD"; + repo = "deface"; + rev = "v${version}"; + hash = "sha256-tLNTgdnKKmyYHVajz0dHIb7cvC1by5LQ5CFIbMvPEYk="; + }; + + nativeBuildInputs = with python3.pkgs; [ + setuptools-scm + ]; + + propagatedBuildInputs = with python3.pkgs; [ + imageio + imageio-ffmpeg + numpy + onnx + onnxruntime # Nixpkgs onnxruntime is missing CUDA support + opencv4 + scikit-image + tqdm + ]; + + # Native onnxruntime lib used by Python module onnxruntime can't find its other libs without this + makeWrapperArgs = [ + ''--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ pkgs.onnxruntime ]}"'' + ]; + + patchPhase = '' + substituteInPlace pyproject.toml requirements.txt --replace "opencv-python" "opencv" + ''; + + # Let setuptools know deface version + SETUPTOOLS_SCM_PRETEND_VERSION = "v${version}"; + + pythonImportsCheck = [ "deface" "onnx" "onnxruntime" ]; + + meta = with lib; { + description = "Video anonymization by face detection"; + homepage = "https://github.com/ORB-HD/deface"; + license = licenses.mit; + maintainers = with maintainers; [ lurkki ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2b09ecd23934..c4a1140053fa 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -41866,6 +41866,8 @@ with pkgs; ov = callPackage ../tools/text/ov { }; + deface = callPackage ../applications/video/deface { }; + tubekit = callPackage ../applications/networking/cluster/tubekit/wrapper.nix { }; tubekit-unwrapped = callPackage ../applications/networking/cluster/tubekit { };