summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohannes Frankenau <johannes@frankenau.net>2018-03-10 12:09:03 +0100
committerProfpatsch <mail@profpatsch.de>2018-07-19 09:50:32 +0200
commit402ee4e9eaf08a697672718cd502067c726a7c73 (patch)
tree8e795cab8320beda4a136cce57d223aa839f05ca
parent1bec0a9ed420de10e9c9143977a2a65644d69194 (diff)
downloadnixlib-402ee4e9eaf08a697672718cd502067c726a7c73.tar
nixlib-402ee4e9eaf08a697672718cd502067c726a7c73.tar.gz
nixlib-402ee4e9eaf08a697672718cd502067c726a7c73.tar.bz2
nixlib-402ee4e9eaf08a697672718cd502067c726a7c73.tar.lz
nixlib-402ee4e9eaf08a697672718cd502067c726a7c73.tar.xz
nixlib-402ee4e9eaf08a697672718cd502067c726a7c73.tar.zst
nixlib-402ee4e9eaf08a697672718cd502067c726a7c73.zip
mpv: use wrapper for scripts and add mpris script
-rw-r--r--pkgs/applications/video/mpv/default.nix4
-rw-r--r--pkgs/applications/video/mpv/scripts/mpris.nix28
-rw-r--r--pkgs/applications/video/mpv/wrapper.nix14
-rw-r--r--pkgs/top-level/all-packages.nix3
4 files changed, 45 insertions, 4 deletions
diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix
index 61e3a7d895d8..cefd5b66aed1 100644
--- a/pkgs/applications/video/mpv/default.nix
+++ b/pkgs/applications/video/mpv/default.nix
@@ -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;
@@ -180,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}"
+  '';
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index aabe94fef4c5..3afb13b28fb4 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -17374,8 +17374,11 @@ with pkgs;
     xvSupport          = !stdenv.isDarwin;
   };
 
+  mpv-with-scripts = callPackage ../applications/video/mpv/wrapper.nix { };
+
   mpvScripts = {
     convert = callPackage ../applications/video/mpv/scripts/convert.nix {};
+    mpris = callPackage ../applications/video/mpv/scripts/mpris.nix {};
   };
 
   mrpeach = callPackage ../applications/audio/pd-plugins/mrpeach { };