mpv: Install all anime4k shaders

This commit is contained in:
PapaTutuWawa 2021-08-22 21:11:00 +02:00
parent 19dbc29559
commit b38ee5f22a
4 changed files with 30 additions and 8082 deletions

View File

@ -1,11 +1,12 @@
{ config, pkgs, ... }:
let
anime4k = pkgs.callPackage ../../../packages/anime4k {};
makeMpvProfile = { shader, additional ? {} }: {
glsl-shaders = "~/.config/mpv/shaders/${shader}";
glsl-shaders = "${anime4k}/usr/share/shaders/${shader}";
scale = "ewa_lanczossharp";
cscale = "ewa_lanczossharp";
gpu-context = "auto";
gpu-context = "wayland";
gpu-api = "opengl";
hwdec = "vaapi";
vo = "gpu";
@ -15,29 +16,25 @@ let
} // additional;
in {
config = {
environment.systemPackages = [ pkgs.mpv ];
environment.systemPackages = with pkgs; [ mpv ];
home-manager.users."${config.system.singleUser}" = {
xdg.configFile = {
"mpv/shaders/Anime4K_Upscale_CNN_UL_x2_Deblur.glsl".source = ./shaders/Anime4K_Upscale_CNN_UL_x2_Deblur.glsl;
"mpv/shaders/Anime4K_Upscale_CNN_UL_x2_Denoise.glsl".source = ./shaders/Anime4K_Upscale_CNN_UL_x2_Denoise.glsl;
};
programs.mpv = {
enable = true;
config = {
script-opts = "try_ytdl_first=no";
af = "loudnorm=I=-30";
};
defaultProfiles = [ "anime" ];
profiles = {
anime = (makeMpvProfile {
shader = "Anime4K_Upscale_CNN_UL_x2_Deblur.glsl";
shader = "Anime4K_Upscale_Denoise_CNN_x2_VL.glsl";
additional = {
fullscreen = "";
};
});
"anime-denoise" = (makeMpvProfile {
shader = "Anime4K_Upscale_CNN_UL_x2_Denoise.glsl";
shader = "Anime4K_Upscale_Denoise_CNN_x2_VL.glsl";
});
};
};

View File

@ -0,0 +1,23 @@
{ stdenv, lib }:
stdenv.mkDerivation rec {
pname = "Anime4k";
version = "4.0.0-RC";
src = builtins.fetchGit {
url = "https://github.com/bloc97/Anime4K.git";
ref = "cb56502ed429a5a3e48ed62c5245d6445a209c7c";
};
installPhase = ''
find ./glsl/ -type f -iname '*.glsl' -exec install -Dm 644 {} -t $out/usr/share/shaders/ \;
'';
meta = with lib; {
description = "A High-Quality Real Time Upscaler for Anime Video ";
homepage = "A High-Quality Real Time Upscaler for Anime Video ";
license = licenses.mit;
maintainers = [ ];
platforms = platforms.linux;
};
}