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

45 lines
1.2 KiB
Nix

{ config, pkgs, ... }:
let
anime4k = pkgs.callPackage ../../../packages/anime4k {};
makeMpvProfile = { shader, additional ? {} }: {
glsl-shaders = "${anime4k}/usr/share/shaders/${shader}";
scale = "ewa_lanczossharp";
cscale = "ewa_lanczossharp";
gpu-context = "wayland";
gpu-api = "opengl";
hwdec = "vaapi";
vo = "gpu";
video-sync = "display-resample";
interpolation = "";
tscale = "oversample";
fs-screen = 0; # Make mpv pop up on the primary screen
} // additional;
in {
config = {
environment.systemPackages = with pkgs; [ mpv ];
home-manager.users."${config.system.singleUser}" = {
programs.mpv = {
enable = true;
config = {
script-opts = "try_ytdl_first=no";
af = "loudnorm=I=-30";
};
defaultProfiles = [ "anime" ];
profiles = {
anime = (makeMpvProfile {
shader = "Anime4K_Upscale_Denoise_CNN_x2_VL.glsl";
additional = {
fullscreen = "";
};
});
"anime-denoise" = (makeMpvProfile {
shader = "Anime4K_Upscale_Denoise_CNN_x2_VL.glsl";
});
};
};
};
};
}