2023-09-14 19:44:27 +01:00
|
|
|
{pkgs, ...}: {
|
2023-09-13 16:21:54 +01:00
|
|
|
services.secrets = {
|
|
|
|
enable = true;
|
2023-09-14 19:44:27 +01:00
|
|
|
|
|
|
|
packages = with pkgs; [rclone];
|
|
|
|
|
2023-09-18 03:56:58 +01:00
|
|
|
vaultLogin = {
|
|
|
|
enable = true;
|
|
|
|
loginUsername = "raspberry";
|
|
|
|
};
|
|
|
|
|
|
|
|
autoSecrets = {
|
|
|
|
enable = true;
|
|
|
|
affectedSystemdServices = ["wg-quick-wg0" "cockroachdb"];
|
|
|
|
};
|
|
|
|
|
2023-09-14 19:44:27 +01:00
|
|
|
extraFunctions = ''
|
|
|
|
simple_get_obscure() {
|
|
|
|
rclone obscure "$(simple_get "$@")"
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
|
|
|
requiredVaultPaths = [
|
2023-09-16 16:06:16 +01:00
|
|
|
"private-public-keys/data/piped-cockroachdb-ca/nodes/raspberry"
|
2023-09-14 19:44:27 +01:00
|
|
|
"private-public-keys/data/cryptsetup/raspberry-ext-drive" # used dynamically
|
|
|
|
"passwords/data/wifi/parentals-home"
|
2023-09-16 16:06:16 +01:00
|
|
|
"api-keys/data/hetzner/storagebox" # also used dynamically
|
2023-09-14 19:44:27 +01:00
|
|
|
];
|
|
|
|
|
2023-09-13 16:21:54 +01:00
|
|
|
secrets = {
|
2023-09-18 03:56:58 +01:00
|
|
|
vault_password = {
|
2023-09-13 19:26:50 +01:00
|
|
|
manual = true;
|
|
|
|
};
|
|
|
|
|
2023-09-16 16:06:16 +01:00
|
|
|
piped_cockroachdb_ca_certificate = {
|
|
|
|
user = "cockroachdb";
|
|
|
|
group = "cockroachdb";
|
|
|
|
permissions = "600";
|
|
|
|
path = "/var/lib/cockroachdb-certs/ca.crt";
|
2023-09-14 19:44:27 +01:00
|
|
|
fetchScript = ''
|
2023-09-16 16:06:16 +01:00
|
|
|
if [ ! -d "$SYSROOT/var/lib/cockroachdb-certs" ]; then
|
|
|
|
mkdir -p "$SYSROOT/var/lib/cockroachdb-certs"
|
|
|
|
fi
|
|
|
|
simple_get "/private-public-keys/piped-cockroachdb-ca/nodes/raspberry" .ca_certificate \
|
|
|
|
| base64 -d > "$secretFile"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
piped_cockroachdb_node_certificate = {
|
|
|
|
user = "cockroachdb";
|
|
|
|
group = "cockroachdb";
|
|
|
|
permissions = "600";
|
|
|
|
path = "/var/lib/cockroachdb-certs/node.crt";
|
|
|
|
fetchScript = ''
|
|
|
|
if [ ! -d "$SYSROOT/var/lib/cockroachdb-certs" ]; then
|
|
|
|
mkdir -p "$SYSROOT/var/lib/cockroachdb-certs"
|
|
|
|
fi
|
|
|
|
simple_get "/private-public-keys/piped-cockroachdb-ca/nodes/raspberry" .node_certificate \
|
|
|
|
| base64 -d > "$secretFile"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
piped_cockroachdb_node_key = {
|
|
|
|
user = "cockroachdb";
|
|
|
|
group = "cockroachdb";
|
|
|
|
permissions = "600";
|
|
|
|
path = "/var/lib/cockroachdb-certs/node.key";
|
|
|
|
fetchScript = ''
|
|
|
|
if [ ! -d "$SYSROOT/var/lib/cockroachdb-certs" ]; then
|
|
|
|
mkdir -p "$SYSROOT/var/lib/cockroachdb-certs"
|
|
|
|
fi
|
|
|
|
simple_get "/private-public-keys/piped-cockroachdb-ca/nodes/raspberry" .node_key \
|
|
|
|
| base64 -d > "$secretFile"
|
2023-09-14 19:44:27 +01:00
|
|
|
'';
|
|
|
|
};
|
2023-09-13 16:21:54 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|