2021-10-07 23:43:05 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
{
|
2021-10-09 01:34:41 +02:00
|
|
|
services.mpd = {
|
2021-10-07 23:43:05 +02:00
|
|
|
enable = true;
|
2021-10-09 01:34:41 +02:00
|
|
|
network.listenAddress = "any";
|
|
|
|
musicDirectory = "/media/syncthing/music-library";
|
|
|
|
playlistDirectory = "/media/syncthing/music-library/playlists";
|
2021-10-07 23:43:05 +02:00
|
|
|
};
|
|
|
|
|
2021-10-09 01:34:41 +02:00
|
|
|
users.groups."syncthing".members = [ "mpd" ];
|
2021-10-07 23:43:05 +02:00
|
|
|
|
|
|
|
sound.enable = true;
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
|
|
6680 # mopidy
|
|
|
|
6600 # mpd
|
|
|
|
1234 # zeroconf
|
|
|
|
];
|
|
|
|
|
|
|
|
users.users."spotifyd" = {
|
|
|
|
isSystemUser = true;
|
2022-01-15 09:32:59 +01:00
|
|
|
group = "spotifyd";
|
2021-10-07 23:43:05 +02:00
|
|
|
};
|
2022-01-15 09:32:59 +01:00
|
|
|
users.groups.spotifyd = { };
|
|
|
|
|
2021-10-07 23:43:05 +02:00
|
|
|
|
|
|
|
sops.secrets.spotify_pass = {
|
|
|
|
owner = "spotifyd";
|
|
|
|
};
|
|
|
|
sops.secrets.spotify_user = {
|
|
|
|
owner = "spotifyd";
|
|
|
|
};
|
|
|
|
|
|
|
|
services.spotifyd.enable = true;
|
|
|
|
services.spotifyd.config = ''
|
2021-11-01 09:20:42 +01:00
|
|
|
[global]
|
|
|
|
username_cmd = "cat ${config.sops.secrets.spotify_user.path}"
|
|
|
|
password_cmd = "cat ${config.sops.secrets.spotify_pass.path}"
|
|
|
|
backend = "alsa" # use portaudio for macOS [homebrew]
|
|
|
|
# The alsa audio device to stream audio to. To get a
|
|
|
|
# list of valid devices, run `aplay -L`,
|
|
|
|
#device = "alsa_audio_device" # omit for macOS
|
|
|
|
# The alsa mixer used by `spotifyd`.
|
|
|
|
mixer = "PCM" # omit for macOS
|
|
|
|
|
|
|
|
# A script that gets evaluated in the user's shell when the song changes [aliases: onevent]
|
|
|
|
on-song-change-hook = "${pkgs.mpc_cli}/bin/mpc --host localhost --port 6600 stop"
|
|
|
|
|
|
|
|
# The volume controller. Each one behaves different to
|
|
|
|
# volume increases. For possible values, run
|
|
|
|
# `spotifyd --help`.
|
|
|
|
volume_controller = "alsa" # use softvol for macOS
|
|
|
|
|
|
|
|
# The name that gets displayed under the connect tab on
|
|
|
|
# official clients. Spaces are not allowed!
|
|
|
|
device_name = "DJane"
|
|
|
|
|
|
|
|
# The audio bitrate. 96, 160 or 320 kbit/s
|
|
|
|
bitrate = 320
|
|
|
|
|
|
|
|
# The directory used to cache audio data. This setting can save
|
|
|
|
# a lot of bandwidth when activated, as it will avoid re-downloading
|
|
|
|
# audio files when replaying them.
|
|
|
|
#
|
|
|
|
# Note: The file path does not get expanded. Environment variables and
|
|
|
|
# shell placeholders like $HOME or ~ don't work!
|
|
|
|
#cache_path = "cache_directory"
|
|
|
|
|
|
|
|
# If set to true, audio data does NOT get cached.
|
|
|
|
no_audio_cache = true
|
|
|
|
|
|
|
|
# Volume on startup between 0 and 100
|
|
|
|
# NOTE: This variable's type will change in v0.4, to a number (instead of string)
|
|
|
|
initial_volume = "90"
|
|
|
|
|
|
|
|
# If set to true, enables volume normalisation between songs.
|
|
|
|
volume_normalisation = false
|
|
|
|
|
|
|
|
# The normalisation pregain that is applied for each song.
|
|
|
|
# normalisation_pregain = -10
|
|
|
|
|
|
|
|
# The port `spotifyd` uses to announce its service over the network.
|
|
|
|
zeroconf_port = 1234
|
|
|
|
|
|
|
|
# The proxy `spotifyd` will use to connect to spotify.
|
|
|
|
#proxy = "http://proxy.example.org:8080"
|
|
|
|
|
|
|
|
# The displayed device type in Spotify clients.
|
|
|
|
# Can be unknown, computer, tablet, smartphone, speaker, t_v,
|
|
|
|
# a_v_r (Audio/Video Receiver), s_t_b (Set-Top Box), and audio_dongle.
|
|
|
|
device_type = "computer"
|
|
|
|
'';
|
2021-10-07 23:43:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
}
|