2021-08-25 10:06:38 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2021-07-29 20:21:51 +00:00
|
|
|
|
|
|
|
let
|
2023-09-17 11:35:43 +00:00
|
|
|
#mkAnime4kShader = shader: "${pkgs.anime4k}/usr/share/shaders/${shader}";
|
2022-03-31 14:53:42 +00:00
|
|
|
mkDefaultShader = shader: "${pkgs.mpv-shader-pack}/usr/share/shaders/${shader}";
|
2023-09-17 11:35:43 +00:00
|
|
|
makeMpvProfile = { shader ? null, gpuContext ? "waylandvk", additional ? {} }: {
|
|
|
|
glsl-shaders = lib.mkIf (shader != null) shader;
|
2021-07-29 20:21:51 +00:00
|
|
|
scale = "ewa_lanczossharp";
|
|
|
|
cscale = "ewa_lanczossharp";
|
2022-04-07 17:54:10 +00:00
|
|
|
gpu-context = gpuContext;
|
2022-03-31 14:53:42 +00:00
|
|
|
gpu-api = "vulkan";
|
2021-07-29 20:21:51 +00:00
|
|
|
hwdec = "vaapi";
|
|
|
|
vo = "gpu";
|
|
|
|
video-sync = "display-resample";
|
|
|
|
interpolation = "";
|
|
|
|
tscale = "oversample";
|
2021-11-01 20:33:21 +00:00
|
|
|
} // additional // (if config.ptw.programs.mpv != "" then {
|
2021-08-25 10:06:38 +00:00
|
|
|
# Make mpv pop up on the primary screen
|
2021-11-01 20:33:21 +00:00
|
|
|
screen-name = config.ptw.programs.mpv.primaryScreen;
|
2022-03-31 14:53:42 +00:00
|
|
|
fs-screen-name = config.ptw.programs.mpv.primaryScreen;} else {});
|
2021-11-01 20:33:21 +00:00
|
|
|
cfg = config.ptw.programs.mpv;
|
2021-07-29 20:21:51 +00:00
|
|
|
in {
|
2021-11-01 20:33:21 +00:00
|
|
|
options.ptw.programs.mpv = {
|
|
|
|
enable = lib.mkEnableOption "Enable and configure mpv using HomeManager";
|
2021-08-25 10:06:38 +00:00
|
|
|
primaryScreen = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
default = "";
|
|
|
|
description = "The name of the screen to use for fullscreen";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-11-01 20:33:21 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2021-08-22 19:11:00 +00:00
|
|
|
environment.systemPackages = with pkgs; [ mpv ];
|
2021-07-29 20:21:51 +00:00
|
|
|
|
2021-11-01 20:33:21 +00:00
|
|
|
home-manager.users."${config.ptw.system.singleUser}" = {
|
2021-08-04 17:07:42 +00:00
|
|
|
programs.mpv = {
|
|
|
|
enable = true;
|
|
|
|
config = {
|
|
|
|
script-opts = "try_ytdl_first=no";
|
|
|
|
};
|
|
|
|
defaultProfiles = [ "anime" ];
|
|
|
|
profiles = {
|
|
|
|
anime = (makeMpvProfile {
|
2023-09-17 11:35:43 +00:00
|
|
|
#shader = mkAnime4kShader "Anime4K_Upscale_Denoise_CNN_x2_VL.glsl";
|
2021-08-04 17:07:42 +00:00
|
|
|
additional = {
|
|
|
|
fullscreen = "";
|
|
|
|
};
|
|
|
|
});
|
2022-03-31 14:53:42 +00:00
|
|
|
anime-denoise = (makeMpvProfile {
|
2023-09-17 11:35:43 +00:00
|
|
|
#shader = mkAnime4kShader "Anime4K_Upscale_Denoise_CNN_x2_VL.glsl";
|
2022-03-31 14:53:42 +00:00
|
|
|
});
|
|
|
|
non-anime = (makeMpvProfile {
|
|
|
|
shader = mkDefaultShader "FSRCNNX_x2_8-0-4-1.glsl";
|
|
|
|
});
|
|
|
|
non-anime-strong = (makeMpvProfile {
|
|
|
|
shader = mkDefaultShader "FSRCNNX_x2_16-0-4-1.glsl";
|
2021-08-04 17:07:42 +00:00
|
|
|
});
|
|
|
|
};
|
2021-07-29 20:21:51 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|