nixfiles/hosts/hetzner-arm/secrets.nix

52 lines
1.2 KiB
Nix
Raw Normal View History

2023-09-20 18:44:24 +01:00
{pkgs, ...}: {
services.secrets = {
enable = true;
vaultLogin = {
enable = true;
loginUsername = "hetzner-arm";
};
autoSecrets = {
enable = true;
2023-09-20 18:53:09 +01:00
#affectedSystemdServices = [
# "wg-quick-wg0"
#];
2023-09-20 18:44:24 +01:00
};
requiredVaultPaths = [
2023-09-20 19:02:27 +01:00
"private-public-keys/data/ssh/root@hetzner-arm-decrypt"
2023-09-20 18:44:24 +01:00
"api-keys/data/gitlab/gitlab_pages_serve"
];
secrets = {
vault_password = {
manual = true;
};
2023-09-20 19:02:27 +01:00
# this doesn't need to be a secret and can be generated at install time
# but it makes it easier to install.
# it's stored in /nix store anyway
ssh_host_ed25519_key = {
path = "/ssh_host_ed25519_key";
permissions = "600";
fetchScript = ''
simple_get "/private-public-keys/ssh/root@hetzner-arm-decrypt" .private | base64 -d > "$secretFile"
'';
};
2023-09-20 18:44:24 +01:00
# Used directly by server
# for fetching gitlab static sites
gitlab_env = {
#user = "gitlab_artifacts_sync";
#group = "gitlab_artifacts_sync";
2023-09-20 18:44:24 +01:00
fetchScript = ''
token=$(simple_get "/api-keys/gitlab/gitlab_pages_serve" .token)
echo "GITLAB_TOKEN=$token" > "$secretFile"
'';
};
};
};
}