panacea/modules/audio.nix

93 lines
2.1 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, inputs, ... }:
2022-04-25 04:02:37 +02:00
with pkgs;
let
# HACK Replace youtube-dl with yt-dlp in mopidy-youtube
2022-04-25 04:02:37 +02:00
mopidy-youtube-yt_dlp = mopidy-youtube.overrideAttrs (old: rec {
propagatedBuildInputs = old.propagatedBuildInputs
2023-12-02 20:07:48 +01:00
++ [ python3.pkgs.yt-dlp python3.pkgs.ytmusicapi ];
2022-04-25 04:02:37 +02:00
});
soundcloud_token = builtins.readFile ../secrets/soundcloud_token;
2022-04-25 04:02:37 +02:00
in {
2021-03-22 16:27:03 +01:00
# Configure pipewire as sound server
services.pipewire = {
enable = true;
2021-03-22 16:27:03 +01:00
alsa = {
enable = true;
2021-03-22 16:27:03 +01:00
support32Bit = true;
};
2021-03-22 16:27:03 +01:00
pulse.enable = true;
wireplumber.enable = true;
# Enable pipewire-pulse's audio via TCP
extraConfig.pipewire-pulse.tcp-server = {
"pulse.properties" = {
"server.address" = [
"unix:native"
"tcp:127.0.0.1:4713"
];
};
};
};
2021-03-22 16:27:03 +01:00
security.rtkit.enable = true;
# Set up Mopidy
services.mopidy = {
enable = true;
extensionPackages = [
mopidy-mpd
mopidy-local
mopidy-youtube-yt_dlp
2022-09-06 03:19:24 +02:00
mopidy-bandcamp
2023-04-26 23:03:20 +02:00
mopidy-somafm
2023-09-11 16:20:41 +02:00
mopidy-soundcloud
];
configuration = ''
[audio]
output = pulsesink server=127.0.0.1
2020-11-01 12:27:56 +01:00
[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
2023-01-24 03:32:14 +01:00
scan_timeout = 3000
[mpd]
zeroconf = ""
[m3u]
playlists_dir = /home/coolneng/.config/mpd/playlists
base_dir = /home/coolneng/Music
2020-10-05 12:48:44 +02:00
[youtube]
search_results = 50
2022-04-25 04:02:37 +02:00
youtube_dl_package = yt_dlp
2022-11-15 22:56:18 +01:00
musicapi_enabled = true
2020-11-17 01:26:37 +01:00
[somafm]
encoding = aac
quality = highest
[soundcloud]
auth_token = ${soundcloud_token}
explore_songs = 100
'';
};
# MPRIS integration
services.playerctld.enable = true;
}