mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 18:04:41 +02:00
navidrome: migrate as module
This commit is contained in:
parent
2251c22311
commit
c8cf20c2ab
2 changed files with 67 additions and 25 deletions
67
modules/services/navidrome/default.nix
Normal file
67
modules/services/navidrome/default.nix
Normal file
|
@ -0,0 +1,67 @@
|
|||
# A FLOSS self-hosted, subsonic compatible music server
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.services.navidrome;
|
||||
domain = config.networking.domain;
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
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 // {
|
||||
Port = cfg.port;
|
||||
Address = "127.0.0.1"; # Behind reverse proxy, so only loopback
|
||||
MusicFolder = cfg.musicFolder;
|
||||
LogLevel = "info";
|
||||
};
|
||||
};
|
||||
|
||||
my.services.nginx.virtualHosts = [
|
||||
{
|
||||
subdomain = "music";
|
||||
inherit (cfg) port;
|
||||
}
|
||||
];
|
||||
|
||||
webapps.apps.navidrome = {
|
||||
dashboard = {
|
||||
name = "Navidrome";
|
||||
category = "media";
|
||||
icon = "music";
|
||||
link = "https://music.${domain}/app/#/login";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue