summaryrefslogtreecommitdiff
path: root/user-profiles
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
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')
-rw-r--r--user-profiles/mpv/default.nix211
-rw-r--r--user-profiles/yt-dlp.nix34
2 files changed, 132 insertions, 113 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}
diff --git a/user-profiles/yt-dlp.nix b/user-profiles/yt-dlp.nix
index 0af42786..1a30ab5a 100644
--- a/user-profiles/yt-dlp.nix
+++ b/user-profiles/yt-dlp.nix
@@ -1,21 +1,23 @@
1{ config, lib, userName, pkgs, ... }: 1{ config, lib, userName, pkgs, ... }:
2{ 2{
3 home-manager.users.${userName} = { 3 home-manager.users.${userName} = {
4 home.packages = with pkgs; [ yt-dlp ]; 4 programs.yt-dlp = {
5 xdg.configFile."yt-dlp/config".text = '' 5 enable = true;
6 --cookies-from-browser firefox 6 settings = {
7 --mark-watched 7 cookies-from-browser = "firefox";
8 --format ${lib.concatStringsSep "/" [ 8 mark-watched = true;
9 "bestvideo[width<=3840][height<=2160][fps<=60]+bestaudio" 9 format = lib.concatStringsSep "/" [
10 "best[width<=3840][height<=2160][fps<=60]" 10 "bestvideo[width<=3840][height<=2160][fps<=60]+bestaudio"
11 "best" 11 "best[width<=3840][height<=2160][fps<=60]"
12 ]} 12 "best"
13 --sub-langs all,-live_chat 13 ];
14 --prefer-free-formats 14 sub-langs = "all,-live_chat,-rechat";
15 --embed-metadata 15 prefer-free-formats = true;
16 --downloader ${pkgs.aria2}/bin/aria2c 16 embed-metadata = true;
17 --sponsorblock-mark all 17 downloader = "${pkgs.aria2}/bin/aria2c";
18 --restrict-filenames 18 sponsorblock-mark = "all";
19 ''; 19 restrict-filenames = true;
20 };
21 };
20 }; 22 };
21} 23}