{ config, lib, pkgs, ... }: with pkgs; # HACK Replace youtube-dl with yt-dlp in mopidy-youtube let mopidy-youtube-yt_dlp = mopidy-youtube.overrideAttrs (old: rec { propagatedBuildInputs = old.propagatedBuildInputs ++ [ python3.pkgs.yt-dlp ]; }); in { # Configure pipewire as sound server services.pipewire = { enable = true; media-session.enable = false; alsa = { enable = true; support32Bit = true; }; pulse.enable = true; wireplumber.enable = true; config.pipewire-pulse."context.modules" = [ { "args" = { }; "flags" = [ "ifexists" "nofail" ]; "name" = "libpipewire-module-rtkit"; } { "name" = "libpipewire-module-protocol-native"; } { "name" = "libpipewire-module-client-node"; } { "name" = "libpipewire-module-adapter"; } { "name" = "libpipewire-module-metadata"; } { "args" = { "server.address" = [ "unix:native" "tcp:4713" ]; }; "name" = "libpipewire-module-protocol-pulse"; } ]; }; security.rtkit.enable = true; # Set up Mopidy services.mopidy = { enable = true; extensionPackages = [ mopidy-mpd mopidy-youtube-yt_dlp mopidy-somafm mopidy-local ]; configuration = '' [audio] mixer_volume = output = pulsesink server=127.0.0.1 visualizer = [local] media_dir = /home/coolneng/Music directories = Album Artists local:directory?type=artist&role=albumartist Albums local:directory?type=album Artists local:directory?type=artist Genres local:directory?type=genre excluded_file_extensions = .directory .html .jpeg .jpg .log .nfo .png .txt [mpd] zeroconf = "" [m3u] playlists_dir = /home/coolneng/.config/mpd/playlists base_dir = /home/coolneng/Music [youtube] allow_cache = true search_results = 50 youtube_dl_package = yt_dlp [somafm] encoding = aac quality = highest ''; }; }