{ config, lib, pkgs, ... }: let soundcloud_token = builtins.readFile /home/coolneng/.config/mopidy/soundcloud-auth; in { # Enable ALSA sound.enable = true; # Configure pipewire as sound server services.pipewire = { enable = true; alsa = { enable = true; support32Bit = true; }; pulse.enable = true; jack.enable = true; media-session.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 = with pkgs; [ mopidy-mpd mopidy-soundcloud mopidy-youtube mopidy-somafm mopidy-local ]; configuration = '' [audio] mixer = software mixer_volume = output = pulsesink server=127.0.0.1 visualizer = [local] media_dir = /home/coolneng/Music excluded_file_extensions = .directory .html .jpeg .jpg .log .nfo .png .txt [mpd] zeroconf = "" [http] enabled = false [soundcloud] enabled = true auth_token = ${soundcloud_token} explore_songs = 100 [m3u] playlists_dir = /home/coolneng/.config/mpd/playlists base_dir = /home/coolneng/Music [youtube] search_results = 50 [somafm] encoding = aac quality = highest ''; }; }