From dce843e98018baffd6a7d2d157d3362d1395fb0f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 4 Apr 2023 10:23:25 +0200 Subject: ... --- user-profiles/mpv/default.nix | 211 +++++++++++++++++++++++------------------- 1 file changed, 114 insertions(+), 97 deletions(-) (limited to 'user-profiles/mpv') 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 @@ { 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; - subs-with-matching-audio = false; - audio-display = false; - osd-font = "Fira Sans"; - sub-font = "Fira 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;interact" - "chapterskip-categories=sponsor>%[SponsorBlock%]: .*Sponsor.*;intro>%[SponsorBlock%]: .*Intro Animation.*;endcard>%[SponsorBlock%]: .*Endcards.*;interact>%[SponsorBlock%]: .*Interaction Reminder.*" - "sub_select-config=${pkgs.writeTextDir "sub-select.json" (builtins.toJSON [ - { - alang = "*"; - slang = "forced"; - } - { - alang = ["jpn" "ja"]; - slang = "eng?"; - blacklist = [ "sign" ]; - } - { - alang = ["jpn" "ja"]; - slang = "und"; - blacklist = [ "sign" ]; - } - { - alang = ["eng?" "deu?"]; - slang = "no"; - } - { - alang = "*"; - slang = "eng?"; - } - { - alang = "*"; - slang = "und"; - } - ])}" - ]; - }; - 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} - ''; + 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; + subs-with-matching-audio = false; + audio-display = false; + osd-font = "Fira Sans"; + sub-font = "Fira 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;interact" + "chapterskip-categories=sponsor>%[SponsorBlock%]: .*Sponsor.*;intro>%[SponsorBlock%]: .*Intro Animation.*;endcard>%[SponsorBlock%]: .*Endcards.*;interact>%[SponsorBlock%]: .*Interaction Reminder.*" + "sub_select-config=${pkgs.writeTextDir "sub-select.json" (builtins.toJSON [ + { + alang = "*"; + slang = "forced"; + } + { + alang = ["jpn" "ja"]; + slang = "eng?"; + blacklist = [ "sign" ]; + } + { + alang = ["jpn" "ja"]; + slang = "und"; + blacklist = [ "sign" ]; + } + { + alang = ["eng?" "deu?"]; + slang = "no"; + } + { + alang = "*"; + slang = "eng?"; + } + { + alang = "*"; + slang = "und"; + } + ])}" + ]; + }; + 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 = "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 = "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} + ''; - 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; [ pkg-config glib mpv ]; - nativeBuildInputs = with pkgs; [ pkg-config 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 = "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"; + })) + (pkgs.stdenv.mkDerivation (sources.mpv-subselect // rec { + installPhase = '' + install -d $out/share/mpv/scripts + install -m 0644 sub-select.lua $out/share/mpv/scripts/${passthru.scriptName} + ''; - passthru.scriptName = "chapterskip.lua"; - })) - (pkgs.stdenv.mkDerivation (sources.mpv-subselect // rec { - installPhase = '' - install -d $out/share/mpv/scripts - install -m 0644 sub-select.lua $out/share/mpv/scripts/${passthru.scriptName} - ''; + passthru.scriptName = "sub-select.lua"; + })) + (pkgs.stdenv.mkDerivation (sources.mpv-youtube-quality // rec { + patches = [ + (pkgs.fetchpatch { url = "https://github.com/jgreco/mpv-youtube-quality/pull/31.patch"; hash = "sha256-2aTTkW48uRe8XC1ZQ8J5T9sUmZ5F3YAoYCMxqEs2AY8="; }) + (pkgs.fetchpatch { url = "https://github.com/jgreco/mpv-youtube-quality/pull/20.patch"; hash = "sha256-X5BwDsxziYbeiQvrBt8+IS+6oH1i0LvaaYtugL790gg="; }) + ]; + + installPhase = '' + install -d $out/share/mpv/scripts + install -m 0644 youtube-quality.lua $out/share/mpv/scripts/${passthru.scriptName} + ''; + + passthru.scriptName = "youtube-quality.lua"; + })) + ]; + }; - passthru.scriptName = "sub-select.lua"; - })) - ]; + xdg.configFile."mpv/youtube-dl".source = "${pkgs.yt-dlp}/bin/yt-dlp"; }; } -- cgit v1.2.3