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

46 lines
1.2 KiB
Nix

{ config, pkgs, ... }:
let
makeMpvProfile = { shader, additional ? {} }: {
glsl-shaders = "${pkgs.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";
# TODO: Make those two configurable
screen-name = "C27F398";
fs-screen-name = "C27F398"; # 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";
});
};
};
};
};
}