From 7c12d2cf8931642dc59fa08b3077e36ce989a76f Mon Sep 17 00:00:00 2001 From: Matteo Pacini Date: Thu, 27 Feb 2025 20:29:42 +0000 Subject: [PATCH] video2x: init at 6.4.0 --- pkgs/by-name/vi/video2x/package.nix | 94 +++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 pkgs/by-name/vi/video2x/package.nix diff --git a/pkgs/by-name/vi/video2x/package.nix b/pkgs/by-name/vi/video2x/package.nix new file mode 100644 index 000000000000..244187e99578 --- /dev/null +++ b/pkgs/by-name/vi/video2x/package.nix @@ -0,0 +1,94 @@ +{ + lib, + stdenv, + cmake, + fetchFromGitHub, + pkg-config, + versionCheckHook, + nix-update-script, + boost, + ffmpeg, + glslang, + llvmPackages, + ncnn, + spdlog, + vulkan-headers, + vulkan-loader, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "video2x"; + version = "6.4.0"; + + src = fetchFromGitHub { + owner = "k4yt3x"; + repo = "video2x"; + tag = finalAttrs.version; + hash = "sha256-DSsfGAkPOtqqj0FA1N33O+OYmv+CMUsrvmh5SrnF7eA="; + fetchSubmodules = false; + leaveDotGit = true; + postFetch = '' + pushd $out + git reset --hard HEAD + + # Fetch the dependencies that nixpkgs cannot provide (non-recursive) + git submodule update --init third_party/librealesrgan_ncnn_vulkan + git submodule update --init third_party/librealcugan_ncnn_vulkan + git submodule update --init third_party/librife_ncnn_vulkan + + # Cleanup + rm -rf .git + + popd + ''; + }; + + postPatch = '' + substituteInPlace src/fsutils.cpp \ + --replace-fail '/usr/share/video2x' '${placeholder "out"}/share/video2x' + ''; + + strictDeps = true; + + nativeBuildInputs = [ + cmake + pkg-config + glslang + ]; + + buildInputs = + [ + boost + ffmpeg + ncnn + spdlog + vulkan-headers + vulkan-loader + ] + ++ lib.optionals stdenv.cc.isClang [ + llvmPackages.openmp + ]; + + cmakeFlags = [ + # Don't build the libvideo2x shared library, we only need the CLI tool + (lib.cmakeBool "BUILD_SHARED_LIBS" false) + ]; + + nativeInstallCheckInputs = [ versionCheckHook ]; + + versionCheckProgramArg = [ "--version" ]; + doInstallCheck = true; + + passthru = { + updateScript = nix-update-script { }; + }; + + meta = { + description = "AI-powered video upscaling tool"; + changelog = "https://github.com/k4yt3x/video2x/releases/tag/${finalAttrs.version}/CHANGELOG.md"; + homepage = "https://github.com/k4yt3x/video2x"; + license = lib.licenses.agpl3Plus; + platforms = [ "x86_64-linux" ]; + mainProgram = "video2x"; + maintainers = [ lib.maintainers.matteopacini ]; + }; +})