dotfiles/pkgs/mpv-scripts/subserv/default.nix

41 lines
1 KiB
Nix
Raw Normal View History

2023-04-11 00:58:02 +07:00
{ stdenv
2023-04-19 01:58:58 +07:00
, substituteAll
2023-04-11 00:58:02 +07:00
, fetchFromGitHub
, mpv-unwrapped
2023-04-19 01:58:58 +07:00
, port ? 8080
2023-04-11 00:58:02 +07:00
, secondary ? false
, ... }:
stdenv.mkDerivation {
pname = "subserv-mpv-plugin";
version = "0.1";
src = fetchFromGitHub {
owner = "kaervin";
repo = "subserv-mpv-plugin";
rev = "08e312f02f3d3608d61944247d39148c34215f75";
sha256 = "sha256-CXyp+AAgyocAEbhuMMPVDlAiocozPe8tm/dIUofCRL8=";
};
2023-04-19 01:58:58 +07:00
patches = [
# patch for setting port and whether secondary subs should be shown
# (also removes verbose logs)
(substituteAll {
src = ./settings.patch;
inherit port;
sub_text = if secondary then "secondary-sub-text" else "sub-text";
})
# my custom changes
./custom.patch
];
2023-04-11 00:58:02 +07:00
buildInputs = [ mpv-unwrapped ];
installFlags = [ "SCRIPTS_DIR=$(out)/share/mpv/scripts" ];
stripDebugList = [ "share/mpv/scripts" ];
passthru.scriptName = "subserv.so";
buildPhase = ''
gcc -o subserv.so subserv.c -shared -fPIC
'';
installPhase = ''
mkdir -p $out/share/mpv/scripts
cp subserv.so $out/share/mpv/scripts
'';
}