nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 93 lines 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 cmake, 5 fetchFromGitHub, 6 pkg-config, 7 versionCheckHook, 8 nix-update-script, 9 boost, 10 ffmpeg, 11 glslang, 12 llvmPackages, 13 ncnn, 14 spdlog, 15 vulkan-headers, 16 vulkan-loader, 17}: 18stdenv.mkDerivation (finalAttrs: { 19 pname = "video2x"; 20 version = "6.4.0"; 21 22 src = fetchFromGitHub { 23 owner = "k4yt3x"; 24 repo = "video2x"; 25 tag = finalAttrs.version; 26 hash = "sha256-DSsfGAkPOtqqj0FA1N33O+OYmv+CMUsrvmh5SrnF7eA="; 27 fetchSubmodules = false; 28 leaveDotGit = true; 29 postFetch = '' 30 pushd $out 31 git reset --hard HEAD 32 33 # Fetch the dependencies that nixpkgs cannot provide (non-recursive) 34 git submodule update --init third_party/librealesrgan_ncnn_vulkan 35 git submodule update --init third_party/librealcugan_ncnn_vulkan 36 git submodule update --init third_party/librife_ncnn_vulkan 37 38 # Cleanup 39 rm -rf .git 40 41 popd 42 ''; 43 }; 44 45 postPatch = '' 46 substituteInPlace src/fsutils.cpp \ 47 --replace-fail '/usr/share/video2x' '${placeholder "out"}/share/video2x' 48 ''; 49 50 strictDeps = true; 51 52 nativeBuildInputs = [ 53 cmake 54 pkg-config 55 glslang 56 ]; 57 58 buildInputs = [ 59 boost 60 ffmpeg 61 ncnn 62 spdlog 63 vulkan-headers 64 vulkan-loader 65 ] 66 ++ lib.optionals stdenv.cc.isClang [ 67 llvmPackages.openmp 68 ]; 69 70 cmakeFlags = [ 71 # Don't build the libvideo2x shared library, we only need the CLI tool 72 (lib.cmakeBool "BUILD_SHARED_LIBS" false) 73 ]; 74 75 nativeInstallCheckInputs = [ versionCheckHook ]; 76 77 versionCheckProgramArg = "--version"; 78 doInstallCheck = true; 79 80 passthru = { 81 updateScript = nix-update-script { }; 82 }; 83 84 meta = { 85 description = "AI-powered video upscaling tool"; 86 changelog = "https://github.com/k4yt3x/video2x/releases/tag/${finalAttrs.version}/CHANGELOG.md"; 87 homepage = "https://github.com/k4yt3x/video2x"; 88 license = lib.licenses.agpl3Plus; 89 platforms = [ "x86_64-linux" ]; 90 mainProgram = "video2x"; 91 maintainers = [ lib.maintainers.matteopacini ]; 92 }; 93})