From 227c06256c1105007a12fbf554b43c6d11227ba0 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Thu, 13 Jun 2024 16:52:17 -0400 Subject: [PATCH] navidrome: use JSON generator for config --- .../containers/nixos/navidrome/default.nix | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/nixosModules/containers/nixos/navidrome/default.nix b/nixosModules/containers/nixos/navidrome/default.nix index 5f75bfa5..f558bfbb 100644 --- a/nixosModules/containers/nixos/navidrome/default.nix +++ b/nixosModules/containers/nixos/navidrome/default.nix @@ -7,30 +7,26 @@ ... }: { 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.lastFMSecret.file = ../../../../secrets/lastFM/secret.age; age.secrets.spotifyClientId.file = ../../../../secrets/spotify/clientId.age; age.secrets.spotifyClientSecret.file = ../../../../secrets/spotify/clientSecret.age; containers.navidrome = let - navidromeConfig = builtins.toFile "navidrome.json" '' - { - "Address": "0.0.0.0", - "DefaultTheme": "Auto", - "MusicFolder": "/Music", - "Port": ${toString config.alyraffauf.containers.nixos.navidrome.port}, - "SubsonicArtistParticipations": true, - "UIWelcomeMessage": "Welcome to Navidrome! Registrations are closed.", - "Spotify.ID": "@spotifyClientId@", - "Spotify.Secret": "@spotifyClientSecret@", - "LastFM.Enabled": true, - "LastFM.ApiKey": "@lastFMApiKey@", - "LastFM.Secret": "@lastFMSecret@", - "LastFM.Language": "en" - } - ''; + navidromeConfig = builtins.toFile "navidrome.json" (lib.generators.toJSON {} { + Address = "0.0.0.0"; + DefaultTheme = "Auto"; + MusicFolder = "/Music"; + Port = config.alyraffauf.containers.nixos.navidrome.port; + SubsonicArtistParticipations = true; + UIWelcomeMessage = "Welcome to Navidrome @ RaffaufLabs.com"; + "Spotify.ID" = "@spotifyClientId@"; + "Spotify.Secret" = "@spotifyClientSecret@"; + "LastFM.Enabled" = true; + "LastFM.ApiKey" = "@lastFMApiKey@"; + "LastFM.Secret" = "@lastFMSecret@"; + "LastFM.Language" = "en"; + }); in { autoStart = true; bindMounts = {