2021-08-25 10:06:38 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2021-07-29 20:21:51 +00:00
|
|
|
|
|
|
|
let
|
2021-08-02 19:51:25 +00:00
|
|
|
makeMpvProfile = { shader, additional ? {} }: {
|
2021-08-24 10:02:44 +00:00
|
|
|
glsl-shaders = "${pkgs.anime4k}/usr/share/shaders/${shader}";
|
2021-07-29 20:21:51 +00:00
|
|
|
scale = "ewa_lanczossharp";
|
|
|
|
cscale = "ewa_lanczossharp";
|
2021-08-22 19:11:00 +00:00
|
|
|
gpu-context = "wayland";
|
2021-07-29 20:21:51 +00:00
|
|
|
gpu-api = "opengl";
|
|
|
|
hwdec = "vaapi";
|
|
|
|
vo = "gpu";
|
|
|
|
video-sync = "display-resample";
|
|
|
|
interpolation = "";
|
|
|
|
tscale = "oversample";
|
2021-08-25 10:06:38 +00:00
|
|
|
} // additional // (if config.programs.mpv != "" then {
|
|
|
|
# Make mpv pop up on the primary screen
|
|
|
|
screen-name = config.programs.mpv.primaryScreen;
|
|
|
|
fs-screen-name = config.programs.mpv.primaryScreen;
|
|
|
|
} else {});
|
2021-07-29 20:21:51 +00:00
|
|
|
in {
|
2021-08-25 10:06:38 +00:00
|
|
|
options.programs.mpv = {
|
|
|
|
primaryScreen = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
default = "";
|
|
|
|
description = "The name of the screen to use for fullscreen";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-08-04 17:07:42 +00:00
|
|
|
config = {
|
2021-08-22 19:11:00 +00:00
|
|
|
environment.systemPackages = with pkgs; [ mpv ];
|
2021-07-29 20:21:51 +00:00
|
|
|
|
2021-08-04 17:07:42 +00:00
|
|
|
home-manager.users."${config.system.singleUser}" = {
|
|
|
|
programs.mpv = {
|
|
|
|
enable = true;
|
|
|
|
config = {
|
|
|
|
script-opts = "try_ytdl_first=no";
|
|
|
|
};
|
|
|
|
defaultProfiles = [ "anime" ];
|
|
|
|
profiles = {
|
|
|
|
anime = (makeMpvProfile {
|
2021-08-22 19:11:00 +00:00
|
|
|
shader = "Anime4K_Upscale_Denoise_CNN_x2_VL.glsl";
|
2021-08-04 17:07:42 +00:00
|
|
|
additional = {
|
|
|
|
fullscreen = "";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
"anime-denoise" = (makeMpvProfile {
|
2021-08-22 19:11:00 +00:00
|
|
|
shader = "Anime4K_Upscale_Denoise_CNN_x2_VL.glsl";
|
2021-08-04 17:07:42 +00:00
|
|
|
});
|
|
|
|
};
|
2021-07-29 20:21:51 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|