mpv extensions: lift sane_cast,sane_sysvol out to pkgs/

establishing a format for this will make it easier for me to package 3rd-party mpv scripts
This commit is contained in:
2024-10-07 22:49:03 +00:00
parent c9fa30e758
commit 16580235b5
7 changed files with 79 additions and 10 deletions

View File

@@ -161,11 +161,13 @@ in
# i think using `luajit` here instead of `lua` is optional, just i get better perf with it :)
lua = pkgs.luajit.override { enable52Compat = true; self = lua; };
};
scripts = [
pkgs.mpvScripts.mpris
pkgs.mpvScripts.mpv-playlistmanager
pkgs.mpvScripts.mpv-webm
pkgs.mpvScripts.sponsorblock
scripts = with pkgs.mpv-unwrapped; [
scripts.mpris
scripts.mpv-playlistmanager
scripts.mpv-webm
scripts.sane_cast
scripts.sane_sysvol
scripts.sponsorblock
uosc
# visualizer #< XXX(2024-07-23): `visualizer` breaks auto-play-next-track (only when visualizations are disabled)
# pkgs.mpv-uosc-latest
@@ -206,9 +208,7 @@ in
persist.byStore.private = [
"Videos/mpv"
];
fs.".config/mpv/scripts/sane_cast/main.lua".symlink.target = ./sane_cast/main.lua;
fs.".config/mpv/scripts/sane_sysvol/main.lua".symlink.target = ./sane_sysvol/main.lua;
fs.".config/mpv/scripts/sane_sysvol/non_blocking_popen.lua".symlink.target = ./sane_sysvol/non_blocking_popen.lua;
fs.".config/mpv/input.conf".symlink.target = ./input.conf;
fs.".config/mpv/mpv.conf".symlink.target = pkgs.substituteAll {
src = ./mpv.conf;

View File

@@ -35,6 +35,24 @@ let
));
};
### ADDITIONAL MPV SCRIPTS
# build like `nix-build -A mpvScripts.sane-cast`
mpv-unwrapped = unpatched.mpv-unwrapped.overrideAttrs (base: {
# don't update by default since most of these packages are from a different repo (i.e. nixpkgs).
updateWithSuper = false;
passthru = base.passthru // lib.recurseIntoAttrs {
scripts = base.passthru.scripts.overrideScope (sFinal: sPrev: (
lib.recurseIntoAttrs (
lib.filesystem.packagesFromDirectoryRecursive {
inherit (sFinal) callPackage;
directory = ./mpv-scripts;
}
)
));
};
});
### aliases
# nixpkgs = nixpkgs-bootstrap.master;
# nixpkgs-staging = nixpkgs-bootstrap.staging;
@@ -53,9 +71,9 @@ let
sane-overlay = {
sane = lib.recurseIntoAttrs sane-additional;
}
# "additional" packages only get added if their version is newer than upstream
# "additional" packages only get added if their version is newer than upstream, or if they're package sets
// (lib.mapAttrs
(pname: _pkg: if unpatched ? "${pname}" && unpatched."${pname}" ? version && lib.versionAtLeast unpatched."${pname}".version final'.sane."${pname}".version then
(pname: _pkg: if unpatched ? "${pname}" && !(final'.sane.recurseForDerivations or false) && unpatched."${pname}" ? version && lib.versionAtLeast unpatched."${pname}".version final'.sane."${pname}".version then
unpatched."${pname}"
else
final'.sane."${pname}"

View File

@@ -0,0 +1,24 @@
{
buildLua, #< part of the mpvScripts scope
lib,
sane-cast,
xdg-terminal-exec,
}:
buildLua {
pname = "sane_cast";
version = "0.1-unstable";
src = ./.;
preInstall = ''
mkdir sane_cast
mv main.lua sane_cast
'';
passthru.scriptName = "sane_cast";
passthru.extraWrapperArgs = [
"--suffix"
"PATH"
":"
(lib.makeBinPath [ sane-cast xdg-terminal-exec ])
];
}

View File

@@ -0,0 +1,27 @@
{
buildLua, #< part of the mpvScripts scope
lib,
pipewire,
sane-die-with-parent,
wireplumber,
}:
buildLua {
pname = "sane_sysvol";
version = "0.1-unstable";
src = ./.;
preInstall = ''
mkdir sane_sysvol
mv main.lua sane_sysvol
mv non_blocking_popen.lua sane_sysvol
'';
passthru.scriptName = "sane_sysvol";
passthru.extraWrapperArgs = [
"--suffix"
"PATH"
":"
(lib.makeBinPath [ pipewire sane-die-with-parent wireplumber ])
];
}