summaryrefslogtreecommitdiff
path: root/user-profiles/mpv/default.nix
blob: 4d6e3ea6cdc60fc8d17c3f1f8d29bff16aa5ec90 (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
{ 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"
      ];
    };
    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";
      }))
    ];
  };
}