nixos-config/modules/programs/mpv/default.nix

47 lines
1.3 KiB
Nix

{ config, pkgs, ... }:
let
makeMpvProfile = { shader, additional ? {} }: {
glsl-shaders = "~/.config/mpv/shaders/${shader}";
scale = "ewa_lanczossharp";
cscale = "ewa_lanczossharp";
gpu-context = "auto";
gpu-api = "opengl";
hwdec = "vaapi";
vo = "gpu";
video-sync = "display-resample";
interpolation = "";
tscale = "oversample";
} // additional;
in {
config = {
environment.systemPackages = [ 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";
};
defaultProfiles = [ "anime" ];
profiles = {
anime = (makeMpvProfile {
shader = "Anime4K_Upscale_CNN_UL_x2_Deblur.glsl";
additional = {
fullscreen = "";
};
});
"anime-denoise" = (makeMpvProfile {
shader = "Anime4K_Upscale_CNN_UL_x2_Denoise.glsl";
});
};
};
};
};
}