nixfiles/hosts/hetzner-arm/secrets.nix
2023-09-20 19:02:27 +01:00

52 lines
1.2 KiB
Nix

{pkgs, ...}: {
services.secrets = {
enable = true;
vaultLogin = {
enable = true;
loginUsername = "hetzner-arm";
};
autoSecrets = {
enable = true;
#affectedSystemdServices = [
# "wg-quick-wg0"
#];
};
requiredVaultPaths = [
"private-public-keys/data/ssh/root@hetzner-arm-decrypt"
"api-keys/data/gitlab/gitlab_pages_serve"
];
secrets = {
vault_password = {
manual = true;
};
# 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"
'';
};
# Used directly by server
# for fetching gitlab static sites
gitlab_env = {
#user = "gitlab_artifacts_sync";
#group = "gitlab_artifacts_sync";
fetchScript = ''
token=$(simple_get "/api-keys/gitlab/gitlab_pages_serve" .token)
echo "GITLAB_TOKEN=$token" > "$secretFile"
'';
};
};
};
}