This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

Replace 2configs/mpv.nix with tools.mpv

- Remove 2configs/mpv.nix and replace imports with tools.mpv package
- Update desktop configurations to use self.packages.${pkgs.system}.mpv
- Simplify home-media.nix by removing unused mpv import

+2 -103
-1
2configs/home-media.nix
··· 1 1 { self, pkgs, ... }: 2 2 { 3 3 imports = [ 4 - ./mpv.nix 5 4 ]; 6 5 users.users.media = { 7 6 isNormalUser = true;
-100
2configs/mpv.nix
··· 1 - { pkgs, ... }: 2 - 3 - let 4 - dl_subs = pkgs.writers.writePython3Bin "dl_subs" { 5 - libraries = [ pkgs.python3Packages.subliminal ]; 6 - flakeIgnore = [ "E501" ]; 7 - } '' 8 - import babelfish 9 - import subliminal 10 - from pathlib import Path 11 - import sys 12 - import os 13 - 14 - video_path = Path(sys.argv[1]) 15 - video = subliminal.scan_video(video_path) 16 - cache_path = Path(os.path.expanduser("~/.cache/subliminal")) / f"{video.title}.srt" 17 - if not cache_path.exists(): 18 - cache_path.parent.mkdir(parents=True, exist_ok=True) 19 - language = babelfish.Language("eng") 20 - sub = subliminal.download_best_subtitles([video], {language})[video][0] 21 - cache_path.write_bytes(sub.content) 22 - print(cache_path) 23 - ''; 24 - 25 - autosub = pkgs.writeText "autosub.lua" '' 26 - utils = require 'mp.utils' 27 - 28 - -- Log function: log to both terminal and mpv OSD (On-Screen Display) 29 - function log(string, secs) 30 - secs = secs or 2 -- secs defaults to 2 when the secs parameter is absent 31 - mp.msg.warn(string) -- This logs to the terminal 32 - mp.osd_message(string, secs) -- This logs to mpv screen 33 - end 34 - 35 - function download() 36 - log('Searching subtitles ...', 10) 37 - path = mp.get_property('path') 38 - result = utils.subprocess({ args = {"${dl_subs}/bin/dl_subs", path} }) 39 - if result.error == nil then 40 - filename = string.gsub(result.stdout, "\n", "") 41 - log(filename) 42 - mp.commandv('sub_add', filename) 43 - log('Subtitles ready!') 44 - else 45 - log('Subtitles failed downloading') 46 - end 47 - end 48 - 49 - mp.add_key_binding('S', "download_subs", download) 50 - ''; 51 - 52 - mpvInput = pkgs.writeText "mpv.input" '' 53 - : script-binding console/enable 54 - x add audio-delay -0.050 55 - X add audio-delay 0.050 56 - ''; 57 - 58 - mpvConfig = pkgs.writeText "mpv.conf" '' 59 - osd-font-size=20 60 - ''; 61 - 62 - mpv = pkgs.symlinkJoin { 63 - name = "mpv"; 64 - paths = [ 65 - (pkgs.writers.writeDashBin "mpv" '' 66 - set -efu 67 - Y_RES=1081 68 - # we need to disable sponsorblock local database because of 69 - # https://github.com/po5/mpv_sponsorblock/issues/31 70 - exec ${ 71 - pkgs.mpv.override { 72 - scripts = with pkgs.mpvScripts; [ 73 - sponsorblock 74 - quality-menu 75 - vr-reversal 76 - visualizer 77 - ]; 78 - } 79 - }/bin/mpv \ 80 - --no-config \ 81 - --input-conf=${mpvInput} \ 82 - --include=${mpvConfig} \ 83 - --script=${autosub} \ 84 - --ytdl-format="best[height<$Y_RES]" \ 85 - --script-opts=ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp \ 86 - --script-opts-append=sponsorblock-local_database=no \ 87 - --audio-channels=2 \ 88 - "$@" 89 - '') 90 - pkgs.mpv 91 - ]; 92 - }; 93 - 94 - in 95 - { 96 - environment.systemPackages = [ 97 - mpv 98 - dl_subs 99 - ]; 100 - }
+1 -1
2configs/desktops/lib/wayland.nix
··· 7 7 { 8 8 imports = [ 9 9 ../../alacritty.nix 10 - ../../mpv.nix 11 10 ../../power-action.nix 12 11 ../../xdg-open.nix 13 12 ../../yubikey.nix ··· 19 18 { 20 19 users.users.mainUser.packages = [ 21 20 pkgs.sshuttle 21 + self.packages.${pkgs.system}.mpv 22 22 ]; 23 23 security.sudo.extraConfig = '' 24 24 lass ALL= (root) NOPASSWD:SETENV: ${pkgs.sshuttle}/bin/.sshuttle-wrapped
+1 -1
2configs/desktops/lib/x11.nix
··· 7 7 { 8 8 imports = [ 9 9 ../../alacritty.nix 10 - ../../mpv.nix 11 10 ../../power-action.nix 12 11 ../../xdg-open.nix 13 12 ../../yubikey.nix ··· 18 17 { 19 18 users.users.mainUser.packages = [ 20 19 pkgs.sshuttle 20 + self.packages.${pkgs.system}.mpv 21 21 ]; 22 22 security.sudo.extraConfig = '' 23 23 lass ALL= (root) NOPASSWD:SETENV: ${pkgs.sshuttle}/bin/.sshuttle-wrapped