feat(nixos): add navidrome environment secrets
This commit is contained in:
@@ -5,6 +5,9 @@
|
|||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
serviceConfig = config.containers.navidrome.config.modules.services.navidrome;
|
serviceConfig = config.containers.navidrome.config.modules.services.navidrome;
|
||||||
|
lastfmApiKeySecret = "services/navidrome/lastfm/api-key";
|
||||||
|
lastfmSecretSecret = "services/navidrome/lastfm/secret";
|
||||||
|
hostSecrets = ../secrets + "/${config.networking.hostName}.yaml";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.guests.navidrome = {
|
options.guests.navidrome = {
|
||||||
@@ -51,6 +54,10 @@ in
|
|||||||
group = "storage";
|
group = "storage";
|
||||||
mode = "2770";
|
mode = "2770";
|
||||||
};
|
};
|
||||||
|
${serviceConfig.environmentFile} = {
|
||||||
|
file = config.sops.templates."navidrome.env".path;
|
||||||
|
readOnly = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
limits = {
|
limits = {
|
||||||
@@ -60,5 +67,19 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sops.secrets = {
|
||||||
|
${lastfmApiKeySecret}.sopsFile = hostSecrets;
|
||||||
|
${lastfmSecretSecret}.sopsFile = hostSecrets;
|
||||||
|
};
|
||||||
|
|
||||||
|
sops.templates."navidrome.env" = {
|
||||||
|
owner = "root";
|
||||||
|
group = "storage";
|
||||||
|
mode = "0440";
|
||||||
|
content = ''
|
||||||
|
ND_LASTFM_APIKEY=${config.sops.placeholder.${lastfmApiKeySecret}}
|
||||||
|
ND_LASTFM_SECRET=${config.sops.placeholder.${lastfmSecretSecret}}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ in
|
|||||||
readOnly = true;
|
readOnly = true;
|
||||||
description = "Guest path for Navidrome's `MusicFolder` setting.";
|
description = "Guest path for Navidrome's `MusicFolder` setting.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environmentFile = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = "/run/secrets/navidrome.env";
|
||||||
|
readOnly = true;
|
||||||
|
description = "Guest path for Navidrome's environment file.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
@@ -43,6 +50,7 @@ in
|
|||||||
user = "navidrome";
|
user = "navidrome";
|
||||||
group = "storage";
|
group = "storage";
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
|
environmentFile = cfg.environmentFile;
|
||||||
settings = {
|
settings = {
|
||||||
Address = "0.0.0.0";
|
Address = "0.0.0.0";
|
||||||
Port = 4533;
|
Port = 4533;
|
||||||
|
|||||||
Reference in New Issue
Block a user