config.nix/modules/server/media/navidrome.nix
2026-04-11 17:21:28 +02:00

66 lines
1.7 KiB
Nix

{
config,
lib,
pkgs,
...
}:
{
options = {
server.media.navidrome = {
enable = lib.mkEnableOption "enable navidrome";
port = lib.mkOption {
default = 4533;
description = "navidrome port";
};
public = lib.mkEnableOption "make navidrome public";
subdomain = lib.mkOption {
default = "music";
description = "navidrome subdomain";
};
};
};
config = {
services = {
navidrome = {
enable = config.server.media.navidrome.enable;
user = config.user.userName;
group = "users";
settings = {
Address = "0.0.0.0";
Port = config.server.media.navidrome.port;
MusicFolder = "/mnt/Data/Media/Music";
Agents = "lastfm";
AlbumPlayCountMode = "normalized";
EnableDownloads = true;
EnableFavourites = true;
EnableNowPlaying = true;
EnableStarRating = true;
EnableUserEditing = true;
LastFM.Enabled = true;
LastFM.Language = "en";
LastFM.ScrobbleFirstArtistOnly = false;
ListenBrainz.Enabled = true;
Scanner.Enabled = true;
Scanner.Schedule = "1h";
Subsonic.ArtistParticipations = true;
};
};
nginx = {
virtualHosts = {
"${config.server.media.navidrome.subdomain}.${config.networking.domain}" =
if config.server.media.navidrome.public then
{
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.server.media.navidrome.port}";
};
}
else
{ };
};
};
};
};
}