diff --git a/default.nix b/default.nix index 853f610..2255ffa 100644 --- a/default.nix +++ b/default.nix @@ -28,5 +28,6 @@ self: super: { tcanny = super.callPackage ./plugins/tcanny { }; tnlmeans = super.callPackage ./plugins/tnlmeans { }; wwxd = super.callPackage ./plugins/wwxd { }; + znedi3 = super.callPackage ./plugins/znedi3 { }; }; } diff --git a/plugins/znedi3/default.nix b/plugins/znedi3/default.nix new file mode 100644 index 0000000..df12fec --- /dev/null +++ b/plugins/znedi3/default.nix @@ -0,0 +1,50 @@ +{ lib, stdenv, fetchFromGitHub, vapoursynth }: + +stdenv.mkDerivation rec { + pname = "znedi3"; + version = "r2"; + + src = fetchFromGitHub { + owner = "sekrit-twc"; + repo = pname; + rev = version; + sha256 = "1p6563s1b52qisvvwid047jd376sz737lggwfhanci0sqxxphhrb"; + fetchSubmodules = true; + }; + + postPatch = '' + # use system vapoursynth headers (adapted from AUR PKGBUILD) + rm -rf vsxx/{VapourSynth,VSScript,VSHelper}.h + + substituteInPlace vsxx/VapourSynth++.hpp \ + --replace '"VapourSynth.h"' '' \ + --replace '"VSHelper.h"' '' + + substituteInPlace Makefile \ + --replace "VSScript.h" "" \ + --replace "VapourSynth.h" "" \ + --replace "VSHelper.h" "" + ''; + + buildInputs = [ vapoursynth ]; + + makeFlags = (lib.optional stdenv.isx86_64 "X86=1"); + + CPPFLAGS = lib.concatStringsSep " " [ + "-I${vapoursynth}/include/vapoursynth" + "-DNNEDI3_WEIGHTS_PATH=\\\"\"${placeholder "out"}/share/znedi3/nnedi3_weights.bin\"\\\"" + ]; + + installPhase = '' + install -D vsznedi3.so $out/lib/vapoursynth/libvsznedi3.so + install -D nnedi3_weights.bin $out/share/znedi3/nnedi3_weights.bin + ''; + + meta = with lib; { + description = "A CPU optimised nnedi3 filter for VapourSynth"; + homepage = "https://github.com/sekrit-twc/znedi3"; + license = licenses.gpl2Only; + maintainers = with maintainers; [ sbruder ]; + platforms = platforms.all; + }; +}