summaryrefslogtreecommitdiff
path: root/user-profiles/mpv/default.nix
blob: 33b0ffafe1a4c7821a6042b954776337227d327f (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
64
65
66
67
68
69
70
{ config, lib, userName, pkgs, sources, ... }:
{
  home-manager.users.${userName}.programs.mpv = {
    enable = true;
    bindings = {
      # "CTRL+n" = "af toggle \"lavfi=[dynaudnorm=f=100:g=31:s=20.0]\"";
    };
    config = {
      ytdl = true;
      sub = false;
      osd-font = "DejaVu Sans";
      # vo = "gpu";
      hwdec = "auto";
      force-window = "yes";
      # af = "lavfi=[dynaudnorm=f=100:g=31:s=20.0]";
      script-opts = lib.concatStringsSep "," [
        "osc-layout=topbar"
        "vidscale=no"
        "deadzonesize=0.9"
        "ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp"
        "chapterskip-skip=sponsor;intro;endcard"
        "chapterskip-categories=sponsor>%[SponsorBlock%]: .*Sponsor.*;intro>%[SponsorBlock%]: .*Intro Animation.*;endcard>%[SponsorBlock%]: .*Endcards.*"
      ];
    };
    scripts = [
      (pkgs.stdenv.mkDerivation (sources.mpv-reload // rec {
        installPhase = ''
          install -d $out/share/mpv/scripts
          install -m 0644 reload.lua $out/share/mpv/scripts/${passthru.scriptName}
        '';

        passthru.scriptName = "reload.lua";
      }))
      (pkgs.stdenv.mkDerivation (sources.mpv-createchapter // rec {
        installPhase = ''
          install -d $out/share/mpv/scripts
          install -m 0644 createchapter.lua $out/share/mpv/scripts/${passthru.scriptName}
        '';

        passthru.scriptName = "createchapter.lua";
      }))
      (pkgs.stdenv.mkDerivation (sources.mpv-autosave // rec {
        installPhase = ''
          install -d $out/share/mpv/scripts
          install -m 0644 autosave.lua $out/share/mpv/scripts/${passthru.scriptName}
        '';

        passthru.scriptName = "autosave.lua";
      }))
      (pkgs.stdenv.mkDerivation (sources.mpv-mpris // rec {
        installPhase = ''
          install -d $out/share/mpv/scripts
          install -m 0644 mpris.so $out/share/mpv/scripts/${passthru.scriptName}
        '';

        nativeBuildInputs = with pkgs; [ pkgconfig glib mpv ];

        passthru.scriptName = "mpris.so";
      }))
      (pkgs.stdenv.mkDerivation (sources.mpv-chapterskip // rec {
        installPhase = ''
          install -d $out/share/mpv/scripts
          install -m 0644 chapterskip.lua $out/share/mpv/scripts/${passthru.scriptName}
        '';

        passthru.scriptName = "chapterskip.lua";
      }))
    ];
  };
}