diff options
Diffstat (limited to 'pkgs/applications/video/mpv')
-rw-r--r-- | pkgs/applications/video/mpv/default.nix | 11 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/scripts/mpris.nix | 28 | ||||
-rw-r--r-- | pkgs/applications/video/mpv/wrapper.nix | 14 |
3 files changed, 46 insertions, 7 deletions
diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix index 7880c3150872..cefd5b66aed1 100644 --- a/pkgs/applications/video/mpv/default.nix +++ b/pkgs/applications/video/mpv/default.nix @@ -3,7 +3,7 @@ , freefont_ttf, freetype, libass, libpthreadstubs , lua, luasocket, libuchardet, libiconv ? null, darwin -, x11Support ? true, +, x11Support ? stdenv.isLinux, libGLU_combined ? null, libX11 ? null, libXext ? null, @@ -38,9 +38,6 @@ , vapoursynthSupport ? false, vapoursynth ? null , archiveSupport ? false, libarchive ? null , jackaudioSupport ? false, libjack2 ? null - -# scripts you want to be loaded by default -, scripts ? [] }: with stdenv.lib; @@ -98,7 +95,8 @@ in stdenv.mkDerivation rec { patchShebangs ./TOOLS/ ''; - NIX_LDFLAGS = optionalString x11Support "-lX11 -lXext"; + NIX_LDFLAGS = optionalString x11Support "-lX11 -lXext " + + optionalString stdenv.isDarwin "-framework CoreFoundation"; configureFlags = [ "--enable-libmpv-shared" @@ -155,7 +153,7 @@ in stdenv.mkDerivation rec { ++ optionals x11Support [ libX11 libXext libGLU_combined libXxf86vm libXrandr ] ++ optionals waylandSupport [ wayland wayland-protocols libxkbcommon ] ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ - libiconv Cocoa CoreAudio + CoreFoundation libiconv Cocoa CoreAudio ]); enableParallelBuilding = true; @@ -179,7 +177,6 @@ in stdenv.mkDerivation rec { ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf # Ensure youtube-dl is available in $PATH for MPV wrapProgram $out/bin/mpv \ - --add-flags "--scripts=${concatStringsSep "," scripts}" \ --prefix LUA_PATH : "${luaPath}" \ --prefix LUA_CPATH : "${luaCPath}" \ '' + optionalString youtubeSupport '' diff --git a/pkgs/applications/video/mpv/scripts/mpris.nix b/pkgs/applications/video/mpv/scripts/mpris.nix new file mode 100644 index 000000000000..e98ba9bdc3fb --- /dev/null +++ b/pkgs/applications/video/mpv/scripts/mpris.nix @@ -0,0 +1,28 @@ +{ stdenv, fetchFromGitHub, pkgconfig, gobjectIntrospection, mpv }: + +stdenv.mkDerivation rec { + name = "mpv-mpris-${version}.so"; + version = "0.1"; + + src = fetchFromGitHub { + owner = "hoyon"; + repo = "mpv-mpris"; + rev = "v${version}"; + sha256 = "0rsbrbv5q7vki59wdlx4cdkd0vvd79qgbjvdb3fn3li7aznvjwiy"; + }; + + nativeBuildInputs = [ pkgconfig ]; + + buildInputs = [ gobjectIntrospection mpv ]; + + installPhase = '' + cp mpris.so $out + ''; + + meta = with stdenv.lib; { + description = "MPRIS plugin for mpv"; + homepage = https://github.com/hoyon/mpv-mpris; + license = licenses.mit; + maintainers = with maintainers; [ jfrankenau ]; + }; +} diff --git a/pkgs/applications/video/mpv/wrapper.nix b/pkgs/applications/video/mpv/wrapper.nix new file mode 100644 index 000000000000..624c06414fd3 --- /dev/null +++ b/pkgs/applications/video/mpv/wrapper.nix @@ -0,0 +1,14 @@ +{ stdenv, symlinkJoin, makeWrapper, mpv, scripts ? [] }: + +symlinkJoin { + name = "mpv-with-scripts-${mpv.version}"; + + paths = [ mpv ]; + + buildInputs = [ makeWrapper ]; + + postBuild = '' + wrapProgram $out/bin/mpv \ + --add-flags "${stdenv.lib.concatMapStringsSep " " (x: "--script=" + x) scripts}" + ''; +} |