Jump to content

Mopidy: Difference between revisions

From Official NixOS Wiki
Klinger (talk | contribs)
m Category:Server
Klinger (talk | contribs)
m link to website, Category:Python added
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Mopidy is an MPD-compatible music server written in Python.
[https://mopidy.com/ Mopidy] is an MPD-compatible music server written in Python.


On NixOS, Mopidy is configured via the <code>services.mopidy</code> options.
On NixOS, Mopidy is configured via the <code>services.mopidy</code> [https://search.nixos.org/options?query=services.mopidy options].


== Extensions ==
== Extensions ==
Line 8: Line 8:
=== mopidy-youtube ===
=== mopidy-youtube ===
By default, the <code>mopidy-youtube</code> extension relies on [https://github.com/ytdl-org/youtube-dl youtube-dl] as the backend for downloading from YouTube, but it can be configured to use a compatible alternative backend such as [https://github.com/yt-dlp/yt-dlp yt-dlp]. Due to the way Mopidy extensions are implemented in nixpkgs, to add another module to the Python environment of <code>mopidy-youtube</code>, the mopidy package set must be overridden like so:
By default, the <code>mopidy-youtube</code> extension relies on [https://github.com/ytdl-org/youtube-dl youtube-dl] as the backend for downloading from YouTube, but it can be configured to use a compatible alternative backend such as [https://github.com/yt-dlp/yt-dlp yt-dlp]. Due to the way Mopidy extensions are implemented in nixpkgs, to add another module to the Python environment of <code>mopidy-youtube</code>, the mopidy package set must be overridden like so:
services.mopidy = let
<nowiki> </nowiki> mopidyPackagesOverride = pkgs.mopidyPackages.overrideScope (prev: final: { extraPkgs = pkgs: [ pkgs.yt-dlp ]; });
in {
<nowiki> </nowiki> extensionPackages = with mopidyPackagesOverride; [
<nowiki> </nowiki>  mopidy-youtube
<nowiki> </nowiki> ];
<nowiki> </nowiki> configuration = <nowiki>''</nowiki>
<nowiki> </nowiki>  [youtube]
<nowiki> </nowiki>  youtube_dl_package = yt_dlp
<nowiki> </nowiki> <nowiki>''</nowiki>;
}


[[Category:Server]]
<syntaxhighlight lang="nix">
services.mopidy = let
  mopidyPackagesOverride = pkgs.mopidyPackages.overrideScope (prev: final: {
    extraPkgs = pkgs: [ pkgs.yt-dlp ];
  });
in {
  extensionPackages = with mopidyPackagesOverride; [
    mopidy-youtube
  ];
  configuration = ''
    [youtube]
    youtube_dl_package = yt_dlp
  '';
}
</syntaxhighlight>
 
[[Category:Server]] [[Category:Python]]

Latest revision as of 21:42, 4 November 2026

Mopidy is an MPD-compatible music server written in Python.

On NixOS, Mopidy is configured via the services.mopidy options.

Extensions

Mopidy extensions are installed by adding their package to services.mopidy.extensionPackages.

mopidy-youtube

By default, the mopidy-youtube extension relies on youtube-dl as the backend for downloading from YouTube, but it can be configured to use a compatible alternative backend such as yt-dlp. Due to the way Mopidy extensions are implemented in nixpkgs, to add another module to the Python environment of mopidy-youtube, the mopidy package set must be overridden like so:

services.mopidy = let
  mopidyPackagesOverride = pkgs.mopidyPackages.overrideScope (prev: final: {
    extraPkgs = pkgs: [ pkgs.yt-dlp ];
  });
in {
  extensionPackages = with mopidyPackagesOverride; [
    mopidy-youtube
  ];
  configuration = ''
    [youtube]
    youtube_dl_package = yt_dlp
  '';
}