navidrome: use JSON generator for config

This commit is contained in:
Aly Raffauf 2024-06-13 16:52:17 -04:00
parent 56e4a8f9b8
commit 227c06256c

View file

@ -7,30 +7,26 @@
... ...
}: { }: {
config = lib.mkIf config.alyraffauf.containers.nixos.navidrome.enable { config = lib.mkIf config.alyraffauf.containers.nixos.navidrome.enable {
# Spotify secrets aren't exactly safe, because they are world-readable in the nix store.
# But they're reasonably disposable and hidden from the public git repo.
age.secrets.lastFMApiKey.file = ../../../../secrets/lastFM/apiKey.age; age.secrets.lastFMApiKey.file = ../../../../secrets/lastFM/apiKey.age;
age.secrets.lastFMSecret.file = ../../../../secrets/lastFM/secret.age; age.secrets.lastFMSecret.file = ../../../../secrets/lastFM/secret.age;
age.secrets.spotifyClientId.file = ../../../../secrets/spotify/clientId.age; age.secrets.spotifyClientId.file = ../../../../secrets/spotify/clientId.age;
age.secrets.spotifyClientSecret.file = ../../../../secrets/spotify/clientSecret.age; age.secrets.spotifyClientSecret.file = ../../../../secrets/spotify/clientSecret.age;
containers.navidrome = let containers.navidrome = let
navidromeConfig = builtins.toFile "navidrome.json" '' navidromeConfig = builtins.toFile "navidrome.json" (lib.generators.toJSON {} {
{ Address = "0.0.0.0";
"Address": "0.0.0.0", DefaultTheme = "Auto";
"DefaultTheme": "Auto", MusicFolder = "/Music";
"MusicFolder": "/Music", Port = config.alyraffauf.containers.nixos.navidrome.port;
"Port": ${toString config.alyraffauf.containers.nixos.navidrome.port}, SubsonicArtistParticipations = true;
"SubsonicArtistParticipations": true, UIWelcomeMessage = "Welcome to Navidrome @ RaffaufLabs.com";
"UIWelcomeMessage": "Welcome to Navidrome! Registrations are closed.", "Spotify.ID" = "@spotifyClientId@";
"Spotify.ID": "@spotifyClientId@", "Spotify.Secret" = "@spotifyClientSecret@";
"Spotify.Secret": "@spotifyClientSecret@", "LastFM.Enabled" = true;
"LastFM.Enabled": true, "LastFM.ApiKey" = "@lastFMApiKey@";
"LastFM.ApiKey": "@lastFMApiKey@", "LastFM.Secret" = "@lastFMSecret@";
"LastFM.Secret": "@lastFMSecret@", "LastFM.Language" = "en";
"LastFM.Language": "en" });
}
'';
in { in {
autoStart = true; autoStart = true;
bindMounts = { bindMounts = {