2021-08-19 11:56:32 +02:00
|
|
|
# A FLOSS self-hosted, subsonic compatible music server
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.my.services.navidrome;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.my.services.navidrome = with lib; {
|
|
|
|
enable = mkEnableOption "Navidrome Music Server";
|
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = (pkgs.formats.json { }).type;
|
|
|
|
default = { };
|
|
|
|
example = {
|
|
|
|
"LastFM.ApiKey" = "MYKEY";
|
|
|
|
"LastFM.Secret" = "MYSECRET";
|
|
|
|
"Spotify.ID" = "MYKEY";
|
|
|
|
"Spotify.Secret" = "MYSECRET";
|
|
|
|
};
|
|
|
|
description = ''
|
|
|
|
Additional settings.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-08-24 23:05:10 +02:00
|
|
|
port = mkOption {
|
2021-08-19 11:56:32 +02:00
|
|
|
type = types.port;
|
|
|
|
default = 4533;
|
|
|
|
example = 8080;
|
|
|
|
description = "Internal port for webui";
|
|
|
|
};
|
|
|
|
|
|
|
|
musicFolder = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "/mnt/music/";
|
|
|
|
description = "Music folder";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
services.navidrome = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
settings = cfg.settings // {
|
2021-08-24 23:05:10 +02:00
|
|
|
Port = cfg.port;
|
2021-08-19 11:56:32 +02:00
|
|
|
Address = "127.0.0.1"; # Behind reverse proxy, so only loopback
|
|
|
|
MusicFolder = cfg.musicFolder;
|
|
|
|
LogLevel = "info";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-12-25 19:25:08 +01:00
|
|
|
my.services.nginx.virtualHosts = {
|
|
|
|
music = {
|
2021-08-24 23:05:10 +02:00
|
|
|
subdomain = "music";
|
|
|
|
inherit (cfg) port;
|
2023-12-25 19:25:08 +01:00
|
|
|
};
|
|
|
|
};
|
2021-08-19 11:56:32 +02:00
|
|
|
};
|
|
|
|
}
|