summaryrefslogtreecommitdiff
path: root/user-profiles/mpv
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2023-04-04 10:23:25 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2023-04-04 10:23:25 +0200
commitdce843e98018baffd6a7d2d157d3362d1395fb0f (patch)
tree7a804575f080beed64fe4746666583461c5f0dc1 /user-profiles/mpv
parent7e7656e22ced47bec5ea5bae1da08e3ef48d2e42 (diff)
downloadnixos-dce843e98018baffd6a7d2d157d3362d1395fb0f.tar
nixos-dce843e98018baffd6a7d2d157d3362d1395fb0f.tar.gz
nixos-dce843e98018baffd6a7d2d157d3362d1395fb0f.tar.bz2
nixos-dce843e98018baffd6a7d2d157d3362d1395fb0f.tar.xz
nixos-dce843e98018baffd6a7d2d157d3362d1395fb0f.zip
...
Diffstat (limited to 'user-profiles/mpv')
-rw-r--r--user-profiles/mpv/default.nix211
1 files changed, 114 insertions, 97 deletions
diff --git a/user-profiles/mpv/default.nix b/user-profiles/mpv/default.nix
index 9c9d077b..908a4de3 100644
--- a/user-profiles/mpv/default.nix
+++ b/user-profiles/mpv/default.nix
@@ -1,108 +1,125 @@
1{ config, lib, userName, pkgs, sources, ... }: 1{ config, lib, userName, pkgs, sources, ... }:
2{ 2{
3 home-manager.users.${userName}.programs.mpv = { 3 home-manager.users.${userName} = {
4 enable = true; 4 programs.mpv = {
5 bindings = { 5 enable = true;
6 # "CTRL+n" = "af toggle \"lavfi=[dynaudnorm=f=100:g=31:s=20.0]\""; 6 bindings = {
7 }; 7 # "CTRL+n" = "af toggle \"lavfi=[dynaudnorm=f=100:g=31:s=20.0]\"";
8 config = { 8 };
9 ytdl = true; 9 config = {
10 subs-with-matching-audio = false; 10 ytdl = true;
11 audio-display = false; 11 subs-with-matching-audio = false;
12 osd-font = "Fira Sans"; 12 audio-display = false;
13 sub-font = "Fira Sans"; 13 osd-font = "Fira Sans";
14 # vo = "gpu"; 14 sub-font = "Fira Sans";
15 hwdec = "auto"; 15 # vo = "gpu";
16 force-window = "yes"; 16 hwdec = "auto";
17 # af = "lavfi=[dynaudnorm=f=100:g=31:s=20.0]"; 17 force-window = "yes";
18 script-opts = lib.concatStringsSep "," [ 18 # af = "lavfi=[dynaudnorm=f=100:g=31:s=20.0]";
19 "osc-layout=topbar" 19 script-opts = lib.concatStringsSep "," [
20 "vidscale=no" 20 "osc-layout=topbar"
21 "deadzonesize=0.9" 21 "vidscale=no"
22 "ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp" 22 "deadzonesize=0.9"
23 "chapterskip-skip=sponsor;intro;endcard;interact" 23 "ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp"
24 "chapterskip-categories=sponsor>%[SponsorBlock%]: .*Sponsor.*;intro>%[SponsorBlock%]: .*Intro Animation.*;endcard>%[SponsorBlock%]: .*Endcards.*;interact>%[SponsorBlock%]: .*Interaction Reminder.*" 24 "chapterskip-skip=sponsor;intro;endcard;interact"
25 "sub_select-config=${pkgs.writeTextDir "sub-select.json" (builtins.toJSON [ 25 "chapterskip-categories=sponsor>%[SponsorBlock%]: .*Sponsor.*;intro>%[SponsorBlock%]: .*Intro Animation.*;endcard>%[SponsorBlock%]: .*Endcards.*;interact>%[SponsorBlock%]: .*Interaction Reminder.*"
26 { 26 "sub_select-config=${pkgs.writeTextDir "sub-select.json" (builtins.toJSON [
27 alang = "*"; 27 {
28 slang = "forced"; 28 alang = "*";
29 } 29 slang = "forced";
30 { 30 }
31 alang = ["jpn" "ja"]; 31 {
32 slang = "eng?"; 32 alang = ["jpn" "ja"];
33 blacklist = [ "sign" ]; 33 slang = "eng?";
34 } 34 blacklist = [ "sign" ];
35 { 35 }
36 alang = ["jpn" "ja"]; 36 {
37 slang = "und"; 37 alang = ["jpn" "ja"];
38 blacklist = [ "sign" ]; 38 slang = "und";
39 } 39 blacklist = [ "sign" ];
40 { 40 }
41 alang = ["eng?" "deu?"]; 41 {
42 slang = "no"; 42 alang = ["eng?" "deu?"];
43 } 43 slang = "no";
44 { 44 }
45 alang = "*"; 45 {
46 slang = "eng?"; 46 alang = "*";
47 } 47 slang = "eng?";
48 { 48 }
49 alang = "*"; 49 {
50 slang = "und"; 50 alang = "*";
51 } 51 slang = "und";
52 ])}" 52 }
53 ]; 53 ])}"
54 }; 54 ];
55 scripts = [ 55 };
56 (pkgs.stdenv.mkDerivation (sources.mpv-reload // rec { 56 scripts = [
57 installPhase = '' 57 (pkgs.stdenv.mkDerivation (sources.mpv-reload // rec {
58 install -d $out/share/mpv/scripts 58 installPhase = ''
59 install -m 0644 reload.lua $out/share/mpv/scripts/${passthru.scriptName} 59 install -d $out/share/mpv/scripts
60 ''; 60 install -m 0644 reload.lua $out/share/mpv/scripts/${passthru.scriptName}
61 '';
62
63 passthru.scriptName = "reload.lua";
64 }))
65 (pkgs.stdenv.mkDerivation (sources.mpv-createchapter // rec {
66 installPhase = ''
67 install -d $out/share/mpv/scripts
68 install -m 0644 createchapter.lua $out/share/mpv/scripts/${passthru.scriptName}
69 '';
61 70
62 passthru.scriptName = "reload.lua"; 71 passthru.scriptName = "createchapter.lua";
63 })) 72 }))
64 (pkgs.stdenv.mkDerivation (sources.mpv-createchapter // rec { 73 (pkgs.stdenv.mkDerivation (sources.mpv-autosave // rec {
65 installPhase = '' 74 installPhase = ''
66 install -d $out/share/mpv/scripts 75 install -d $out/share/mpv/scripts
67 install -m 0644 createchapter.lua $out/share/mpv/scripts/${passthru.scriptName} 76 install -m 0644 autosave.lua $out/share/mpv/scripts/${passthru.scriptName}
68 ''; 77 '';
69 78
70 passthru.scriptName = "createchapter.lua"; 79 passthru.scriptName = "autosave.lua";
71 })) 80 }))
72 (pkgs.stdenv.mkDerivation (sources.mpv-autosave // rec { 81 (pkgs.stdenv.mkDerivation (sources.mpv-mpris // rec {
73 installPhase = '' 82 installPhase = ''
74 install -d $out/share/mpv/scripts 83 install -d $out/share/mpv/scripts
75 install -m 0644 autosave.lua $out/share/mpv/scripts/${passthru.scriptName} 84 install -m 0644 mpris.so $out/share/mpv/scripts/${passthru.scriptName}
76 ''; 85 '';
77 86
78 passthru.scriptName = "autosave.lua"; 87 nativeBuildInputs = with pkgs; [ pkg-config glib mpv ];
79 }))
80 (pkgs.stdenv.mkDerivation (sources.mpv-mpris // rec {
81 installPhase = ''
82 install -d $out/share/mpv/scripts
83 install -m 0644 mpris.so $out/share/mpv/scripts/${passthru.scriptName}
84 '';
85 88
86 nativeBuildInputs = with pkgs; [ pkg-config glib mpv ]; 89 passthru.scriptName = "mpris.so";
90 }))
91 (pkgs.stdenv.mkDerivation (sources.mpv-chapterskip // rec {
92 installPhase = ''
93 install -d $out/share/mpv/scripts
94 install -m 0644 chapterskip.lua $out/share/mpv/scripts/${passthru.scriptName}
95 '';
87 96
88 passthru.scriptName = "mpris.so"; 97 passthru.scriptName = "chapterskip.lua";
89 })) 98 }))
90 (pkgs.stdenv.mkDerivation (sources.mpv-chapterskip // rec { 99 (pkgs.stdenv.mkDerivation (sources.mpv-subselect // rec {
91 installPhase = '' 100 installPhase = ''
92 install -d $out/share/mpv/scripts 101 install -d $out/share/mpv/scripts
93 install -m 0644 chapterskip.lua $out/share/mpv/scripts/${passthru.scriptName} 102 install -m 0644 sub-select.lua $out/share/mpv/scripts/${passthru.scriptName}
94 ''; 103 '';
95 104
96 passthru.scriptName = "chapterskip.lua"; 105 passthru.scriptName = "sub-select.lua";
97 })) 106 }))
98 (pkgs.stdenv.mkDerivation (sources.mpv-subselect // rec { 107 (pkgs.stdenv.mkDerivation (sources.mpv-youtube-quality // rec {
99 installPhase = '' 108 patches = [
100 install -d $out/share/mpv/scripts 109 (pkgs.fetchpatch { url = "https://github.com/jgreco/mpv-youtube-quality/pull/31.patch"; hash = "sha256-2aTTkW48uRe8XC1ZQ8J5T9sUmZ5F3YAoYCMxqEs2AY8="; })
101 install -m 0644 sub-select.lua $out/share/mpv/scripts/${passthru.scriptName} 110 (pkgs.fetchpatch { url = "https://github.com/jgreco/mpv-youtube-quality/pull/20.patch"; hash = "sha256-X5BwDsxziYbeiQvrBt8+IS+6oH1i0LvaaYtugL790gg="; })
102 ''; 111 ];
112
113 installPhase = ''
114 install -d $out/share/mpv/scripts
115 install -m 0644 youtube-quality.lua $out/share/mpv/scripts/${passthru.scriptName}
116 '';
117
118 passthru.scriptName = "youtube-quality.lua";
119 }))
120 ];
121 };
103 122
104 passthru.scriptName = "sub-select.lua"; 123 xdg.configFile."mpv/youtube-dl".source = "${pkgs.yt-dlp}/bin/yt-dlp";
105 }))
106 ];
107 }; 124 };
108} 125}