summaryrefslogtreecommitdiff
path: root/hm/soft/mpv.nix
blob: 8df73e7442a5002fcaaba117f470754ada78b7d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{ config, lib, pkgs, ... }:
let
  cfg = config.hm.soft.mpv;
  shim_dir = "${pkgs.mpv-shim-default-shaders}/share/mpv-shim-default-shaders/shaders";
  anime4k_dir = "${pkgs.anime4k}"
in
{
  options.hm.soft.mpv.enable = lib.mkEnableOption "mpv media player";
  config = lib.mkIf cfg.enable {
    home.packages = with pkgs; [
      anime4k
      mpv-shim-default-shaders
    ];
    programs.mpv = {
      enable = true;
      config = {
        # general stuff
        save-position-on-quit = true;
        keep-open = "yes";

        # video
        profile = "gpu-hq";
        gpu-api = "vulkan";
        vo = "gpu-next";
        hwdec = "auto";

        # audio
        ao = "pipewire";
        sub-auto = "fuzzy";
        volume-max = "200";

        # network streaming
        demuxer-max-back-bytes = "50Mib";
        demuxer-max-bytes = "600Mib";
        demuxer-readahead-secs = 300;
        force-seekable = "yes";

        # screenshotting
        screenshot-format = "png";
        screenshot-directory = "~/${config.hm.conf.xdg-dirs.mediaPath}/pics/ss";
        screenshot-template = "mpv-%f-%wH.%wM.%wS-#%#00n";
      };
      scripts = with pkgs.mpvScripts; [
        webtorrent-mpv-hook
        visualizer
        videoclip
        thumbfast
        reload
        mpv-subtitle-lines
        mpv-notify-send
        mpv-cheatsheet
        modernx
        memo
        autosubsync-mpv
        autosub
      ];
    };
    hm.soft = {
      media.enable = true;
      yt-dlp.enable = true;
    };
  };
}