panacea/modules/audio.nix

83 lines
1.6 KiB
Nix

{ config, lib, pkgs, ... }:
let
soundcloud_token =
builtins.readFile /home/coolneng/.config/mopidy/soundcloud-auth;
latest-mopidy-youtube = pkgs.mopidy-youtube.overrideAttrs (old: rec {
pname = "mopidy-youtube";
version = "3.2";
src = pkgs.python3Packages.fetchPypi {
inherit version;
pname = "Mopidy-YouTube";
sha256 = "0wmalfqnskglssq3gj6kkrq6h6c9yab503y72afhkm7n9r5c57zz";
};
});
in {
# Enable ALSA
sound.enable = true;
# Configure PulseAudio with mopidy tweaks
hardware.pulseaudio = {
enable = true;
tcp = {
enable = true;
anonymousClients.allowedIpRanges = [ "127.0.0.1" ];
};
};
# Set up Mopidy
services.mopidy = {
enable = true;
extensionPackages = with pkgs; [
mopidy-mpd
mopidy-soundcloud
latest-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
'';
};
}