From caff4544d5d4b5c9160a1e48db485991638d233f Mon Sep 17 00:00:00 2001 From: emily Date: Mon, 4 Nov 2024 14:02:36 +0100 Subject: [PATCH] Initial commit uwu --- flake.lock | 27 +++++++++ flake.nix | 38 ++++++++++++ lib/platforms.nix | 15 +++++ pkgs/default.nix | 24 ++++++++ pkgs/neo_dfttest/package.nix | 60 +++++++++++++++++++ pkgs/neo_f3kdb/package.nix | 60 +++++++++++++++++++ pkgs/vapoursynth-bestsource/package.nix | 60 +++++++++++++++++++ pkgs/vapoursynth-bm3d/package.nix | 46 +++++++++++++++ pkgs/vapoursynth-bm3dcuda/package.nix | 56 ++++++++++++++++++ pkgs/vapoursynth-bm3dhip/package.nix | 68 ++++++++++++++++++++++ pkgs/vapoursynth-dfttest/package.nix | 49 ++++++++++++++++ pkgs/vapoursynth-eedi3/package.nix | 56 ++++++++++++++++++ pkgs/vapoursynth-hqdn3d/package.nix | 41 +++++++++++++ pkgs/vapoursynth-knlmeanscl/package.nix | 50 ++++++++++++++++ pkgs/vapoursynth-nnedi3/package.nix | 45 +++++++++++++++ pkgs/vapoursynth-nnedi3cl/package.nix | 50 ++++++++++++++++ pkgs/vapoursynth-wnnm/package.nix | 72 +++++++++++++++++++++++ pkgs/vapoursynth-znedi3/package.nix | 54 +++++++++++++++++ pkgs/vs-dfttest2/package.nix | 77 +++++++++++++++++++++++++ pkgs/vs-nlm-cuda/package.nix | 52 +++++++++++++++++ pkgs/vs-nlm-ispc/package.nix | 54 +++++++++++++++++ 21 files changed, 1054 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 lib/platforms.nix create mode 100644 pkgs/default.nix create mode 100644 pkgs/neo_dfttest/package.nix create mode 100644 pkgs/neo_f3kdb/package.nix create mode 100644 pkgs/vapoursynth-bestsource/package.nix create mode 100644 pkgs/vapoursynth-bm3d/package.nix create mode 100644 pkgs/vapoursynth-bm3dcuda/package.nix create mode 100644 pkgs/vapoursynth-bm3dhip/package.nix create mode 100644 pkgs/vapoursynth-dfttest/package.nix create mode 100644 pkgs/vapoursynth-eedi3/package.nix create mode 100644 pkgs/vapoursynth-hqdn3d/package.nix create mode 100644 pkgs/vapoursynth-knlmeanscl/package.nix create mode 100644 pkgs/vapoursynth-nnedi3/package.nix create mode 100644 pkgs/vapoursynth-nnedi3cl/package.nix create mode 100644 pkgs/vapoursynth-wnnm/package.nix create mode 100644 pkgs/vapoursynth-znedi3/package.nix create mode 100644 pkgs/vs-dfttest2/package.nix create mode 100644 pkgs/vs-nlm-cuda/package.nix create mode 100644 pkgs/vs-nlm-ispc/package.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..165fd81 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1730531603, + "narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b17b72f --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "vapoursynth-nix"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + nixConfig = { + allow-import-form-derivation = true; + extra-substituters = [ + "https://cache.kyouma.net" + ]; + extra-trusted-public-keys = [ + "cache.kyouma.net:Frjwu4q1rnwE/MnSTmX9yx86GNA/z3p/oElGvucLiZg=" + ]; + }; + + outputs = { self, nixpkgs, ... }@inputs: let + inherit (nixpkgs) lib; + buildPlatforms = import ./lib/platforms.nix inputs; + eachSystem = uwu: lib.mapAttrs uwu buildPlatforms; + in { + packages = eachSystem (system: platform: let + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + allowUnsupportedSystem = true; + allowBroken = true; + }; + }; + in lib.filterAttrs (_: pkg: lib.meta.availableOn platform pkg) ( + import ./pkgs/default.nix { inherit pkgs lib; }) + ); + + hydraJobs = { inherit (self) packages; }; + }; +} diff --git a/lib/platforms.nix b/lib/platforms.nix new file mode 100644 index 0000000..b3a37cd --- /dev/null +++ b/lib/platforms.nix @@ -0,0 +1,15 @@ +{ nixpkgs, ... }: let + inherit (nixpkgs) lib; +in lib.mapAttrs (system: platform: lib.systems.elaborate platform) { + "x86_64-linux" = { + system = "x86_64-linux"; + }; + + "aarch64-linux" = { + system = "aarch64-linux"; + }; + + "riscv64-linux" = { + system = "riscv64-linux"; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..5b17136 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,24 @@ +{ lib, pkgs, }: let + inherit (pkgs) callPackage; + load = baseDir: lib.mapAttrs (name: _: callPackage "${baseDir}/${name}/package.nix" {}) ( + lib.filterAttrs (_: type: type == "directory") (builtins.readDir baseDir) + ); +in (load ./.) // { + + vapoursynth-bm3dcpu = callPackage ./vapoursynth-bm3dcuda/package.nix { + cudaSupport = false; + cpuSupport = true; + }; + + vs-dfttest2cuda = callPackage ./vs-dfttest2/package.nix { + cudaSupport = true; + }; + + vs-dfttest2gcc = callPackage ./vs-dfttest2/package.nix { + genericVector = true; + }; + + vs-dfttest2hip = callPackage ./vs-dfttest2/package.nix { + rocmSupport = true; + }; +} diff --git a/pkgs/neo_dfttest/package.nix b/pkgs/neo_dfttest/package.nix new file mode 100644 index 0000000..72896e3 --- /dev/null +++ b/pkgs/neo_dfttest/package.nix @@ -0,0 +1,60 @@ +{ + lib, + stdenv, + fetchFromGitHub, + hostPlatform, + cmake, + pkg-config, + vapoursynth, + tbb, + zimg, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "neo_dfttest"; + version = "8"; + + src = fetchFromGitHub { + owner = "HomeOfAviSynthPlusEvolution"; + repo = "neo_dfttest"; + rev = "refs/tags/r${finalAttrs.version}"; + hash = "sha256-qlgg57Ysr/iwZz6RjJcLEYN/eRaG/LB3dIExY9FyXls="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = [ + vapoursynth + tbb + zimg + ]; + + cmakeFlags = [ (lib.cmakeFeature "VERSION" "r${finalAttrs.version}") ]; + + postPatch = '' + sed -E -i '/^find_package\(Git /,+2d' CMakeLists.txt + rm -rf include/vapoursynth + ''; + + installPhase = '' + runHook preInstall + + install -D -t "$out/lib/vapoursynth" libneo-dfttest${hostPlatform.extensions.sharedLibrary} + + runHook postInstall + ''; + + meta = { + description = "Plugin for VapourSynth: neo_dfttest"; + homepage = "https://github.com/HomeOfAviSynthPlusEvolution/neo_dfttest"; + license = with lib.licenses; [ + gpl3Plus + gpl2Plus + ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = lib.platforms.x86_64; + }; +}) diff --git a/pkgs/neo_f3kdb/package.nix b/pkgs/neo_f3kdb/package.nix new file mode 100644 index 0000000..a216c0f --- /dev/null +++ b/pkgs/neo_f3kdb/package.nix @@ -0,0 +1,60 @@ +{ + lib, + stdenv, + fetchFromGitHub, + hostPlatform, + cmake, + pkg-config, + vapoursynth, + tbb, + zimg, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "neo_f3kdb"; + version = "9"; + + src = fetchFromGitHub { + owner = "HomeOfAviSynthPlusEvolution"; + repo = "neo_f3kdb"; + rev = "refs/tags/r${finalAttrs.version}"; + hash = "sha256-MIvKjsemDeyv9qonuJbns0Dau8BjFQ1REppccs7s9JU="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = [ + vapoursynth + tbb + zimg + ]; + + cmakeFlags = [ (lib.cmakeFeature "VERSION" "r${finalAttrs.version}") ]; + + postPatch = '' + sed -E -i '/^find_package\(Git /,+2d' CMakeLists.txt + rm -rf include/vapoursynth + ''; + + installPhase = '' + runHook preInstall + + install -D -t "$out/lib/vapoursynth" libneo-f3kdb${hostPlatform.extensions.sharedLibrary} + + runHook postInstall + ''; + + meta = { + description = "Plugin for VapourSynth: neo_f3kdb"; + homepage = "https://github.com/HomeOfAviSynthPlusEvolution/neo_f3kdb"; + license = with lib.licenses; [ + gpl3Plus + gpl2Plus + ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = lib.platforms.x86_64; + }; +}) diff --git a/pkgs/vapoursynth-bestsource/package.nix b/pkgs/vapoursynth-bestsource/package.nix new file mode 100644 index 0000000..5f8fe3f --- /dev/null +++ b/pkgs/vapoursynth-bestsource/package.nix @@ -0,0 +1,60 @@ +{ + lib, + stdenv, + fetchFromGitHub, + meson, + ninja, + cmake, + pkg-config, + vapoursynth, + ffmpeg, + xxHash, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "vapoursynth-bestsource"; + version = "6"; + + outputs = [ + "out" + "dev" + ]; + + src = fetchFromGitHub { + fetchSubmodules = true; + owner = "vapoursynth"; + repo = "bestsource"; + rev = "refs/tags/R${finalAttrs.version}"; + hash = "sha256-ICkdIomlkHUdK6kMeui45fvUn4OMxSrP8svB2IN+GCg="; + }; + + nativeBuildInputs = [ + meson + ninja + cmake + pkg-config + ]; + + buildInputs = [ + vapoursynth + ffmpeg + xxHash + ]; + + postPatch = '' + substituteInPlace meson.build \ + --replace-fail "vapoursynth_dep.get_variable(pkgconfig: 'libdir')" "get_option('libdir')" + ''; + + meta = { + description = "Wrapper library around FFmpeg that ensures sample and frame accurate access to audio and video"; + homepage = "https://github.com/vapoursynth/bestsource"; + license = with lib.licenses; [ + mit + wtfpl + gpl2Plus + ]; + platforms = lib.platforms.x86_64; + maintainers = with lib.maintainers; [ snaki ]; + }; +}) diff --git a/pkgs/vapoursynth-bm3d/package.nix b/pkgs/vapoursynth-bm3d/package.nix new file mode 100644 index 0000000..0564c46 --- /dev/null +++ b/pkgs/vapoursynth-bm3d/package.nix @@ -0,0 +1,46 @@ +{ + lib, + stdenv, + fetchFromGitHub, + meson, + ninja, + pkg-config, + vapoursynth, + fftwSinglePrec, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "vapoursynth-bm3d"; + version = "9"; + + src = fetchFromGitHub { + owner = "HomeOfVapourSynthEvolution"; + repo = "VapourSynth-BM3D"; + rev = "refs/tags/r${finalAttrs.version}"; + hash = "sha256-i7Kk7uFt2Wo/EWpVkGyuYgGZxBuQgOT3JM+WCFPHVrc="; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + vapoursynth + fftwSinglePrec + ]; + + postPatch = '' + substituteInPlace meson.build \ + --replace-fail "vapoursynth_dep.get_pkgconfig_variable('libdir')" "get_option('libdir')" + ''; + + meta = { + inherit (vapoursynth.meta) platforms; + description = "Plugin for VapourSynth: bm3d"; + homepage = "https://github.com/HomeOfVapourSynthEvolution/VapourSynth-BM3D"; + license = with lib.licenses; [ mit ]; + maintainers = with lib.maintainers; [ snaki ]; + }; +}) diff --git a/pkgs/vapoursynth-bm3dcuda/package.nix b/pkgs/vapoursynth-bm3dcuda/package.nix new file mode 100644 index 0000000..1ecca3b --- /dev/null +++ b/pkgs/vapoursynth-bm3dcuda/package.nix @@ -0,0 +1,56 @@ +{ + lib, + gcc12Stdenv, + fetchFromGitHub, + cmake, + cudaPackages_12_3, + vapoursynth, + cudaSupport ? true, + cpuSupport ? false, +}: + +# gcc13 producdes weird artifacts +gcc12Stdenv.mkDerivation (finalAttrs: { + pname = "vapoursynth-bm3dcuda"; + version = "2.14"; + + src = fetchFromGitHub { + owner = "WolframRhodium"; + repo = "VapourSynth-BM3DCUDA"; + rev = "refs/tags/R${finalAttrs.version}"; + hash = "sha256-Vcg1RaV0lOMAK0LCAJBMMeeSC0HoKigHwebzH/AcH2g="; + }; + + nativeBuildInputs = + [ cmake ] + ++ lib.optionals cudaSupport [ + cudaPackages_12_3.cuda_nvcc + cudaPackages_12_3.cuda_nvrtc + ]; + + buildInputs = lib.optionals cudaSupport [ cudaPackages_12_3.cuda_cudart ]; + + # Taken from https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/blob/main/.github/workflows/linux.yml + preConfigure = + '' + cmakeFlagsArray+=(${lib.escapeShellArg (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-ffast-math${lib.optionalString cpuSupport " -march=x86-64-v3"}")}) + '' + + lib.optionalString cudaSupport '' + cmakeFlagsArray+=(${lib.escapeShellArg (lib.cmakeFeature "CMAKE_CUDA_FLAGS" "--use_fast_math -Wno-deprecated-gpu-targets")}) + ''; + + cmakeFlags = [ + (lib.cmakeFeature "VAPOURSYNTH_INCLUDE_DIRECTORY" "${vapoursynth}/include/vapoursynth") + (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib/vapoursynth") + (lib.cmakeBool "ENABLE_CUDA" cudaSupport) + (lib.cmakeBool "ENABLE_CPU" cpuSupport) + ]; + + meta = { + description = "Plugin for VapourSynth: bm3dcuda bm3dcpu"; + homepage = "https://github.com/WolframRhodium/VapourSynth-BM3DCUDA"; + license = with lib.licenses; [ gpl2Plus ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = with lib.platforms; if cpuSupport then x86_64 else all; + }; +}) diff --git a/pkgs/vapoursynth-bm3dhip/package.nix b/pkgs/vapoursynth-bm3dhip/package.nix new file mode 100644 index 0000000..b85e60f --- /dev/null +++ b/pkgs/vapoursynth-bm3dhip/package.nix @@ -0,0 +1,68 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + rocmPackages, + vapoursynth, + gpuTargets ? [ + "gfx1010" + "gfx1011" + "gfx1012" + "gfx1030" + "gfx1031" + "gfx1032" + "gfx1033" + "gfx1034" + "gfx1035" + "gfx1036" + "gfx1100" + "gfx1101" + "gfx1102" + "gfx1103" + ], +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "vapoursynth-bm3dhip"; + version = "2.14"; + + src = fetchFromGitHub { + owner = "WolframRhodium"; + repo = "VapourSynth-BM3DCUDA"; + rev = "refs/tags/R${finalAttrs.version}"; + hash = "sha256-Vcg1RaV0lOMAK0LCAJBMMeeSC0HoKigHwebzH/AcH2g="; + }; + + nativeBuildInputs = [ + cmake + rocmPackages.clr + ]; + + buildInputs = [ rocmPackages.clr ]; + + # Taken from https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/blob/main/.github/workflows/linux.yml + preConfigure = '' + cmakeFlagsArray=( + ${lib.escapeShellArg (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-ffast-math -munsafe-fp-atomics")} + ) + ''; + + cmakeFlags = [ + (lib.cmakeFeature "VAPOURSYNTH_INCLUDE_DIRECTORY" "${vapoursynth}/include/vapoursynth") + (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib/vapoursynth") + (lib.cmakeFeature "CMAKE_CXX_COMPILER" "hipcc") + (lib.cmakeFeature "GPU_TARGETS" (lib.concatStringsSep ";" gpuTargets)) + (lib.cmakeBool "ENABLE_CUDA" false) + (lib.cmakeBool "ENABLE_CPU" false) + (lib.cmakeBool "ENABLE_HIP" true) + ]; + + meta = { + description = "Plugin for VapourSynth: bm3dhip"; + homepage = "https://github.com/WolframRhodium/VapourSynth-BM3DCUDA"; + license = with lib.licenses; [ gpl2Plus ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = with lib.platforms; aarch64 ++ x86_64; + }; +}) diff --git a/pkgs/vapoursynth-dfttest/package.nix b/pkgs/vapoursynth-dfttest/package.nix new file mode 100644 index 0000000..a444971 --- /dev/null +++ b/pkgs/vapoursynth-dfttest/package.nix @@ -0,0 +1,49 @@ +{ + lib, + stdenv, + fetchFromGitHub, + meson, + ninja, + pkg-config, + vapoursynth, + fftwSinglePrec, +}: + +stdenv.mkDerivation { + pname = "vapoursynth-dfttest"; + version = "unstable-2022-04-15"; + + src = fetchFromGitHub { + owner = "HomeOfVapourSynthEvolution"; + repo = "VapourSynth-DFTTest"; + rev = "bc5e0186a7f309556f20a8e9502f2238e39179b8"; + hash = "sha256-HGk9yrs6T3LAP0I5GPt9b4LwldXtQDG277ffX6xMr/4="; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + vapoursynth + fftwSinglePrec + ]; + + postPatch = '' + substituteInPlace meson.build \ + --replace-fail "vapoursynth_dep.get_pkgconfig_variable('libdir')" "get_option('libdir')" + ''; + + meta = { + description = "Plugin for VapourSynth: dfttest"; + homepage = "https://github.com/HomeOfVapourSynthEvolution/VapourSynth-DFTTest"; + license = with lib.licenses; [ + gpl3Plus + asl20 + ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = lib.platforms.x86_64; + }; +} diff --git a/pkgs/vapoursynth-eedi3/package.nix b/pkgs/vapoursynth-eedi3/package.nix new file mode 100644 index 0000000..3a5f8b5 --- /dev/null +++ b/pkgs/vapoursynth-eedi3/package.nix @@ -0,0 +1,56 @@ +{ + lib, + stdenv, + fetchFromGitHub, + meson, + ninja, + pkg-config, + boost, + vapoursynth, + opencl-headers, + ocl-icd, + openclSupport ? true, +}: + +stdenv.mkDerivation { + pname = "vapoursynth-eedi3"; + version = "unstable-2019-09-30"; + + src = fetchFromGitHub { + owner = "HomeOfVapourSynthEvolution"; + repo = "VapourSynth-EEDI3"; + rev = "d11bdb37c7a7118cd095b53d9f8fbbac02a06ac0"; + hash = "sha256-MIUf6sOnJ2uqGw3ixEHy1ijzlLFkQauwtm1vfgmYmcg="; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = + [ + boost + vapoursynth + ] + ++ lib.optionals openclSupport [ + ocl-icd + opencl-headers + ]; + + postPatch = '' + substituteInPlace meson.build \ + --replace-fail "vapoursynth_dep.get_pkgconfig_variable('libdir')" "get_option('libdir')" + ''; + + mesonFlags = [ (lib.mesonBool "opencl" openclSupport) ]; + + meta = { + description = "Filter for VapourSynth"; + homepage = "https://github.com/HomeOfVapourSynthEvolution/VapourSynth-EEDI3"; + license = with lib.licenses; [ gpl2Plus ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = lib.platforms.x86_64; + }; +} diff --git a/pkgs/vapoursynth-hqdn3d/package.nix b/pkgs/vapoursynth-hqdn3d/package.nix new file mode 100644 index 0000000..d5575b0 --- /dev/null +++ b/pkgs/vapoursynth-hqdn3d/package.nix @@ -0,0 +1,41 @@ +{ + lib, + stdenv, + fetchFromGitHub, + autoreconfHook, + pkg-config, + vapoursynth, +}: + +stdenv.mkDerivation { + pname = "vapoursynth-hqdn3d"; + version = "unstable-2023-07-09"; + + src = fetchFromGitHub { + owner = "Hinterwaeldlers"; + repo = "vapoursynth-hqdn3d"; + rev = "eb820cb23f7dc47eb67ea95def8a09ab69251d30"; + hash = "sha256-BObHZs7GQW6UFUwohII1MXHtk5ooGh/LfZ3ZsqoPQBU="; + }; + + nativeBuildInputs = [ + autoreconfHook + pkg-config + ]; + + buildInputs = [ vapoursynth ]; + + configureFlags = [ "--libdir=$(out)/lib/vapoursynth" ]; + + postInstall = '' + rm -f $out/lib/vapoursynth/*.la + ''; + + meta = { + inherit (vapoursynth.meta) platforms; + description = "Plugin for VapourSynth: hqdn3d"; + homepage = "https://github.com/Hinterwaeldlers/vapoursynth-hqdn3d"; + license = with lib.licenses; [ gpl2Plus ]; + maintainers = with lib.maintainers; [ snaki ]; + }; +} diff --git a/pkgs/vapoursynth-knlmeanscl/package.nix b/pkgs/vapoursynth-knlmeanscl/package.nix new file mode 100644 index 0000000..19da739 --- /dev/null +++ b/pkgs/vapoursynth-knlmeanscl/package.nix @@ -0,0 +1,50 @@ +{ + lib, + stdenv, + fetchFromGitHub, + meson, + ninja, + pkg-config, + boost, + vapoursynth, + opencl-headers, + ocl-icd, +}: + +stdenv.mkDerivation { + pname = "vapoursynth-knlmeanscl"; + version = "unstable-2023-06-05"; + + src = fetchFromGitHub { + owner = "Khanattila"; + repo = "KNLMeansCL"; + rev = "ca424fa91d1e16ec011f7db9c3ba0d1e76ed7850"; + hash = "sha256-co8Jaup3bvvJaKw830CqCkAKHRsT5rx/xAYMbGhrMRk="; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + boost + vapoursynth + ocl-icd + opencl-headers + ]; + + postPatch = '' + rm -rf KNLMeansCL/{avi,vapour}synth + sed -E -i '/NLMAvisynth\.(h|cpp)/d' meson.build + ''; + + meta = { + description = "Plugin for VapourSynth: knlmeanscl"; + homepage = "https://github.com/Khanattila/KNLMeansCL"; + license = with lib.licenses; [ gpl3Plus ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = lib.platforms.x86_64; + }; +} diff --git a/pkgs/vapoursynth-nnedi3/package.nix b/pkgs/vapoursynth-nnedi3/package.nix new file mode 100644 index 0000000..1fe4b85 --- /dev/null +++ b/pkgs/vapoursynth-nnedi3/package.nix @@ -0,0 +1,45 @@ +{ + lib, + stdenv, + fetchFromGitHub, + autoreconfHook, + pkg-config, + vapoursynth, + yasm, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "vapoursynth-nnedi3"; + version = "12"; + + src = fetchFromGitHub { + owner = "dubhater"; + repo = "vapoursynth-nnedi3"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-jd/PCXhbCZGMsoXjekbeqMSRVBJAy4INdpkTbZFjVO0="; + }; + + nativeBuildInputs = [ + autoreconfHook + pkg-config + ]; + + buildInputs = [ + vapoursynth + yasm + ]; + + configureFlags = [ "--libdir=$(out)/lib/vapoursynth" ]; + + postInstall = '' + rm -f $out/lib/vapoursynth/*.la + ''; + + meta = { + description = "Filter for VapourSynth"; + homepage = "https://github.com/dubhater/vapoursynth-nnedi3"; + license = with lib.licenses; [ gpl2Plus ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = with lib.platforms; x86_64 ++ aarch64; + }; +}) diff --git a/pkgs/vapoursynth-nnedi3cl/package.nix b/pkgs/vapoursynth-nnedi3cl/package.nix new file mode 100644 index 0000000..14fb147 --- /dev/null +++ b/pkgs/vapoursynth-nnedi3cl/package.nix @@ -0,0 +1,50 @@ +{ + lib, + stdenv, + fetchFromGitHub, + meson, + ninja, + pkg-config, + boost, + vapoursynth, + opencl-headers, + ocl-icd, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "vapoursynth-nnedi3cl"; + version = "8"; + + src = fetchFromGitHub { + owner = "HomeOfVapourSynthEvolution"; + repo = "VapourSynth-NNEDI3CL"; + rev = "refs/tags/r${finalAttrs.version}"; + hash = "sha256-zW/qEtZTDJOTarXbXhv+nks25eePutLDpLck4TuMKUk="; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + boost + vapoursynth + ocl-icd + opencl-headers + ]; + + postPatch = '' + substituteInPlace meson.build \ + --replace-fail "vapoursynth_dep.get_pkgconfig_variable('libdir')" "get_option('libdir')" + ''; + + meta = { + description = "Filter for VapourSynth"; + homepage = "https://github.com/HomeOfVapourSynthEvolution/VapourSynth-NNEDI3CL"; + license = with lib.licenses; [ gpl2Plus ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = lib.platforms.x86_64; + }; +}) diff --git a/pkgs/vapoursynth-wnnm/package.nix b/pkgs/vapoursynth-wnnm/package.nix new file mode 100644 index 0000000..5442411 --- /dev/null +++ b/pkgs/vapoursynth-wnnm/package.nix @@ -0,0 +1,72 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + pkg-config, + mkl, + vapoursynth, + zimg, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "vapoursynth-wnnm"; + version = "unstable-2023-07-07"; + + srcs = [ + (fetchFromGitHub { + owner = "WolframRhodium"; + repo = "VapourSynth-WNNM"; + rev = "a8977b4365841bb27c232383cd9a306f70ef9f99"; + name = "${finalAttrs.pname}-source"; + hash = "sha256-B4jvl+Lu724QofDbKQObdcpQdlb8KQ2szAp780J9SUY="; + }) + (fetchFromGitHub { + owner = "vectorclass"; + repo = "version2"; + rev = "refs/tags/v2.02.01"; + name = "vectorclass"; + hash = "sha256-45qt0vGz6ibEmcoPZDOeroSivoVnFkvMEihjXJXa8lU="; + }) + ]; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = [ + (mkl.override { enableStatic = true; }) + vapoursynth + zimg + ]; + + sourceRoot = "${finalAttrs.pname}-source"; + + preConfigure = '' + cmakeFlagsArray=(${lib.escapeShellArg (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-ffast-math -mavx2 -mfma")}) + ''; + + cmakeFlags = [ + (lib.cmakeFeature "VCL_HOME" (toString (lib.last finalAttrs.srcs))) + (lib.cmakeFeature "MKL_LINK" "static") + (lib.cmakeFeature "MKL_INTERFACE" "lp64") + (lib.cmakeFeature "MKL_THREADING" "sequential") + ]; + + postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace-fail "\''${VS_LIBDIR}" "lib" + ''; + + meta = { + description = "Plugin for VapourSynth: wnnm"; + homepage = "https://github.com/WolframRhodium/VapourSynth-WNNM"; + license = with lib.licenses; [ + mit + asl20 + ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = lib.platforms.x86_64; + }; +}) diff --git a/pkgs/vapoursynth-znedi3/package.nix b/pkgs/vapoursynth-znedi3/package.nix new file mode 100644 index 0000000..cd5b7f9 --- /dev/null +++ b/pkgs/vapoursynth-znedi3/package.nix @@ -0,0 +1,54 @@ +{ + lib, + stdenv, + fetchFromGitHub, + vapoursynth, +}: + +stdenv.mkDerivation { + pname = "vapoursynth-znedi3"; + version = "unstable-2023-07-09"; + + src = fetchFromGitHub { + fetchSubmodules = true; + owner = "sekrit-twc"; + repo = "znedi3"; + rev = "68dc130bc37615fd912d1dc1068261f00f54b146"; + hash = "sha256-QC+hMMfp6XwW4PqsN6sip1Y7ttiYn/xuxq/pUg/trog="; + }; + + buildInputs = [ vapoursynth ]; + + postPatch = '' + rm -rf vsxx/vapoursynth + ln -s ${vapoursynth}/include/vapoursynth vsxx/vapoursynth + ''; + + makeFlags = + [ "CPPFLAGS=-DNNEDI3_WEIGHTS_PATH='\"$(out)/share/nnedi3/nnedi3_weights.bin\"'" ] + ++ lib.optionals stdenv.hostPlatform.isx86 [ + "X86=1" + "X86_AVX512=1" + ]; + + installPhase = '' + runHook preInstall + + install -D -t $out/lib/vapoursynth vsznedi3${stdenv.hostPlatform.extensions.sharedLibrary} + install -D -m644 -t $out/share/nnedi3 nnedi3_weights.bin + + runHook postInstall + ''; + + meta = { + inherit (vapoursynth.meta) platforms; + description = "Filter for VapourSynth"; + homepage = "https://github.com/sekrit-twc/znedi3"; + license = with lib.licenses; [ + gpl2Plus + wtfpl + lgpl21 + ]; + maintainers = with lib.maintainers; [ snaki ]; + }; +} diff --git a/pkgs/vs-dfttest2/package.nix b/pkgs/vs-dfttest2/package.nix new file mode 100644 index 0000000..8c96685 --- /dev/null +++ b/pkgs/vs-dfttest2/package.nix @@ -0,0 +1,77 @@ +{ + lib, + gcc12Stdenv, + fetchFromGitHub, + cmake, + pkg-config, + cudaPackages_11_8, + rocmPackages, + vapoursynth, + zimg, + cudaSupport ? false, + rocmSupport ? false, + genericVector ? false, +}: + +# Based on project's CI +gcc12Stdenv.mkDerivation (finalAttrs: { + pname = "vs-dfttest2"; + version = "7"; + + src = fetchFromGitHub { + fetchSubmodules = true; + owner = "AmusementClub"; + repo = "vs-dfttest2"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-6VFUVdCKSbdhjKBUacQXEN5IyB4crngglAM99h+hGxU="; + }; + + nativeBuildInputs = + [ + cmake + pkg-config + ] + ++ lib.optionals cudaSupport [ + cudaPackages_11_8.cuda_nvcc + cudaPackages_11_8.cuda_nvrtc + ] + ++ lib.optionals rocmSupport [ rocmPackages.clr ]; + + buildInputs = + [ + vapoursynth + zimg + ] + ++ lib.optionals cudaSupport [ + cudaPackages_11_8.cuda_cudart + cudaPackages_11_8.libcufft + ] + ++ lib.optionals rocmSupport [ + rocmPackages.clr + rocmPackages.hipfft + ]; + + cmakeFlags = [ + (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-ffast-math") + (lib.cmakeBool "ENABLE_CUDA" cudaSupport) + (lib.cmakeBool "ENABLE_HIP" rocmSupport) + (lib.cmakeBool "ENABLE_CPU" (!genericVector)) + (lib.cmakeBool "ENABLE_GCC" genericVector) + ]; + + postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace-fail "\''${VS_LIBDIR}" "lib" + ''; + + meta = { + description = "Plugin for VapourSynth: dfttest2"; + homepage = "https://github.com/AmusementClub/vs-dfttest2"; + license = with lib.licenses; [ + gpl3 + asl20 + ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = with lib.platforms; if genericVector then all else x86_64; + }; +}) diff --git a/pkgs/vs-nlm-cuda/package.nix b/pkgs/vs-nlm-cuda/package.nix new file mode 100644 index 0000000..7adf99f --- /dev/null +++ b/pkgs/vs-nlm-cuda/package.nix @@ -0,0 +1,52 @@ +{ + lib, + gcc12Stdenv, + fetchFromGitHub, + cmake, + pkg-config, + cudaPackages_11_8, + vapoursynth, + zimg, +}: + +gcc12Stdenv.mkDerivation (finalAttrs: { + pname = "vs-nlm-cuda"; + version = "1"; + + src = fetchFromGitHub { + owner = "AmusementClub"; + repo = "vs-nlm-cuda"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-VxIe3ec0Hxgcd6HTDbZ9zx6Ss0H2eOtRVLq1ftIwRPY="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + cudaPackages_11_8.cuda_nvcc + cudaPackages_11_8.cuda_nvrtc + ]; + + buildInputs = [ + cudaPackages_11_8.cuda_cudart + vapoursynth + zimg + ]; + + preConfigure = '' + cmakeFlagsArray=(${lib.escapeShellArg (lib.cmakeFeature "CMAKE_CUDA_FLAGS" "--use_fast_math -Wno-deprecated-gpu-targets")}) + ''; + + postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace-fail "\''${VS_LIBDIR}" "lib" + ''; + + meta = { + description = "Plugin for VapourSynth: vs-nlm-cuda"; + homepage = "https://github.com/AmusementClub/vs-nlm-cuda"; + license = with lib.licenses; [ gpl3 ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = lib.platforms.all; + }; +}) diff --git a/pkgs/vs-nlm-ispc/package.nix b/pkgs/vs-nlm-ispc/package.nix new file mode 100644 index 0000000..041ada9 --- /dev/null +++ b/pkgs/vs-nlm-ispc/package.nix @@ -0,0 +1,54 @@ +{ + lib, + stdenv, + fetchFromGitHub, + hostPlatform, + cmake, + pkg-config, + ispc, + vapoursynth, + zimg, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "vs-nlm-ispc"; + version = "2"; + + src = fetchFromGitHub { + owner = "AmusementClub"; + repo = "vs-nlm-ispc"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-lP/6a83Sy+R4umt2GiZnB/to/x6jjGOChgUFQZQUwz4="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + ispc + ]; + + buildInputs = [ + vapoursynth + zimg + ]; + + cmakeFlags = [ + (lib.cmakeFeature "CMAKE_ISPC_INSTRUCTION_SETS" ( + if hostPlatform.isx86_64 then "sse2-i32x4;avx1-i32x4;avx2-i32x8" else "neon-i32x4" + )) + (lib.cmakeFeature "CMAKE_ISPC_FLAGS" "--opt=fast-math") + ]; + + postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace-fail "\''${VS_LIBDIR}" "lib" + ''; + + meta = { + description = "Plugin for VapourSynth: vs-nlm-ispc"; + homepage = "https://github.com/AmusementClub/vs-nlm-ispc"; + license = with lib.licenses; [ gpl3 ]; + maintainers = with lib.maintainers; [ snaki ]; + platforms = with lib.platforms; x86_64 ++ aarch64; + }; +})