nixos/containers/navidrome: cleanup

This commit is contained in:
Aly Raffauf 2024-06-30 15:51:20 -04:00
parent 6be75be909
commit 1d4ec0ff6c

View file

@ -1,9 +1,7 @@
{
config,
inputs,
lib,
pkgs,
self,
...
}: {
config = lib.mkIf config.ar.containers.nixos.navidrome.enable {
@ -29,6 +27,7 @@
});
in {
autoStart = true;
bindMounts = {
"/Music".hostPath = config.ar.containers.nixos.navidrome.musicDirectory;
"/var/lib/navidrome/rawNavidrome.json".hostPath = navidromeConfig;
@ -37,6 +36,7 @@
"${config.age.secrets.spotifyClientId.path}".isReadOnly = true;
"${config.age.secrets.spotifyClientSecret.path}".isReadOnly = true;
};
config = let
lastFMApiKey = config.age.secrets.lastFMApiKey.path;
lastFMSecret = config.age.secrets.lastFMSecret.path;
@ -49,8 +49,8 @@
lib,
...
}: {
system.stateVersion = "24.05";
system.activationScripts."navidrome-secrets" = ''
system = {
activationScripts."navidrome-secrets" = ''
lastFMApiKey=$(cat "${lastFMApiKey}")
lastFMSecret=$(cat "${lastFMSecret}")
spotifyClientId=$(cat "${spotifyClientId}")
@ -60,13 +60,18 @@
/var/lib/navidrome/rawNavidrome.json > /var/lib/navidrome/navidrome.json
'';
stateVersion = "24.05";
};
systemd.services.navidrome.serviceConfig = {
BindReadOnlyPaths = "/Music";
ExecStart = lib.mkForce ''
${config.services.navidrome.package}/bin/navidrome --configfile /var/lib/navidrome/navidrome.json \
--datafolder /var/lib/navidrome/
'';
BindReadOnlyPaths = "/Music";
};
services.navidrome = {
enable = true;
openFirewall = true;