vocard: use sops templating

This commit is contained in:
Gerg-L 2025-02-06 22:08:35 -05:00
parent 2486e01083
commit b3b731207b
Signed by: gerg-l
SSH key fingerprint: SHA256:FPYDHIkvMocr4wdmZXpgpJjsb2Tw6rASs2ISPbOb0KI
6 changed files with 81 additions and 16 deletions

View file

@ -1,11 +1,71 @@
{
self',
lib,
config,
}:
{
sops = {
secrets =
builtins.mapAttrs
(
_: v:
v
// {
sopsFile = ./secrets.yaml;
}
)
{
"vocard/token" = { };
"vocard/client_id" = { };
"vocard/spotify_client_id" = { };
"vocard/spotify_client_secret" = { };
"lavalink/refresh_token" = { };
"lavalink/password" = { };
};
templates = {
vocard.content =
builtins.replaceStrings
[
"@token@"
"@client_id@"
"@spotify_client_id@"
"@spotify_client_secret@"
"@password@"
]
[
config.sops.placeholder."vocard/token"
config.sops.placeholder."vocard/client_id"
config.sops.placeholder."vocard/spotify_client_id"
config.sops.placeholder."vocard/spotify_client_secret"
config.sops.placeholder."lavalink/password"
]
(builtins.readFile ./settings.json);
lavalink.content =
builtins.replaceStrings
[
"@refresh_token@"
"@password@"
]
[
config.sops.placeholder."lavalink/refresh_token"
config.sops.placeholder."lavalink/password"
]
(builtins.readFile ./application.yml);
};
};
systemd.tmpfiles.rules = [
"d /persist/services/vocard - - - - -"
"d /persist/services/lavalink - - - - -"
"L+ /persist/services/vocard/settings.json - - - - ${config.sops.templates.vocard.path}"
"L+ /persist/services/lavalink/application.yml - - - - ${config.sops.templates.lavalink.path}"
];
systemd.services = {