style(nixos): name navidrome guest configs

This commit is contained in:
2026-09-12 21:13:23 -04:00
parent e188e4e0dd
commit fa918d4476

View File

@@ -4,7 +4,8 @@
... ...
}: }:
let let
serviceConfig = config.containers.navidrome.config.modules.services.navidrome; guestCfg = config.guests.navidrome;
serviceCfg = config.containers.navidrome.config.modules.services.navidrome;
lastfmApiKeySecret = "services/navidrome/lastfm/api-key"; lastfmApiKeySecret = "services/navidrome/lastfm/api-key";
lastfmSecretSecret = "services/navidrome/lastfm/secret"; lastfmSecretSecret = "services/navidrome/lastfm/secret";
hostSecrets = ../secrets + "/${config.networking.hostName}.yaml"; hostSecrets = ../secrets + "/${config.networking.hostName}.yaml";
@@ -26,14 +27,14 @@ in
}; };
}; };
config = lib.mkIf config.guests.navidrome.enable { config = lib.mkIf guestCfg.enable {
assertions = [ assertions = [
{ {
assertion = config.guests.navidrome.dataPath != null; assertion = guestCfg.dataPath != null;
message = "guests.navidrome.dataPath must point at the host directory that stores Navidrome data."; message = "guests.navidrome.dataPath must point at the host directory that stores Navidrome data.";
} }
{ {
assertion = config.guests.navidrome.libraryPath != null; assertion = guestCfg.libraryPath != null;
message = "guests.navidrome.libraryPath must point at the host directory that stores Navidrome's library folder."; message = "guests.navidrome.libraryPath must point at the host directory that stores Navidrome's library folder.";
} }
]; ];
@@ -42,19 +43,19 @@ in
interior.modules.services.navidrome.enable = true; interior.modules.services.navidrome.enable = true;
mounts = { mounts = {
${serviceConfig.dataFolder} = { ${serviceCfg.dataFolder} = {
directory = config.guests.navidrome.dataPath; directory = guestCfg.dataPath;
owner = config.registry."stable-uid".${config.networking.hostName}.navidrome; owner = config.registry."stable-uid".${config.networking.hostName}.navidrome;
group = "storage"; group = "storage";
mode = "2770"; mode = "2770";
}; };
${serviceConfig.musicFolder} = { ${serviceCfg.musicFolder} = {
directory = config.guests.navidrome.libraryPath; directory = guestCfg.libraryPath;
owner = "root"; owner = "root";
group = "storage"; group = "storage";
mode = "2770"; mode = "2770";
}; };
${serviceConfig.environmentFile} = { ${serviceCfg.environmentFile} = {
file = config.sops.templates."navidrome.env".path; file = config.sops.templates."navidrome.env".path;
readOnly = true; readOnly = true;
}; };