MPV: Difference between revisions

From NixOS Wiki
imported>Doronbehar
Add instructions for launching mpv with scripts
 
imported>Doronbehar
m Remove unused headline at end
Line 33: Line 33:
}
}
</syntaxhighlight>
</syntaxhighlight>
== Running mpv with scripts ==
If you'd like to add

Revision as of 09:51, 18 July 2019

There are 2 packages that provide an mpv executable:

  • mpv
  • mpv-with-scripts

mpv-with-scripts is a wrapper for the mpv binary which adds --script= arguments according to the scripts the wrapper was built with.

If you'd like to add scripts to your mpv wrapper, you'll need to override the package in ~/.config/nixpkgs/config.nix:

{
  packageOverrides = pkgs: with pkgs; rec {
    mpv-with-scripts = pkgs.mpv-with-scripts.override {
      scripts = [pkgs.mpvScripts.<your choice>];
    };
  };
}

All of the scripts for MPV can be found under the mpvScripts attribute. If you have shell completion for nix-env -iA, you can discover them there, if not, you can find them in the following directory of the Nixpkgs source code:

pkgs/applications/video/mpv/scripts

So for example, for adding the MPRIS MPV script, use the following in your ~/.config/nixpkgs/config.nix:

{
  packageOverrides = pkgs: with pkgs; rec {
    mpv-with-scripts = pkgs.mpv-with-scripts.override {
      scripts = [pkgs.mpvScripts.mpris];
    };
  };
}