2023-09-13 16:21:54 +01:00
|
|
|
{...}: {
|
|
|
|
services.secrets = {
|
|
|
|
enable = true;
|
|
|
|
secrets = {
|
2023-09-13 19:26:50 +01:00
|
|
|
# Used for fetching the encryption drive's key at runtime
|
|
|
|
# can be revoked in case of hardware theft
|
|
|
|
# Can also run vault-login on host before secrets-init to fetch secrets using raspberry's login
|
|
|
|
vault_login_password = {
|
|
|
|
manual = true;
|
|
|
|
};
|
|
|
|
|
2023-09-13 16:21:54 +01:00
|
|
|
home-wifi-password = {
|
|
|
|
user = "root";
|
|
|
|
group = "root";
|
2023-09-13 19:26:50 +01:00
|
|
|
permissions = "600";
|
2023-09-13 16:21:54 +01:00
|
|
|
path = "/etc/NetworkManager/system-connections/Home-WiFi.nmconnection";
|
|
|
|
|
|
|
|
fetchScript = ''
|
|
|
|
ssid=$(simple_get "/passwords/wifi/parentals-home" .ssid)
|
|
|
|
password=$(simple_get "/passwords/wifi/parentals-home" .password)
|
|
|
|
|
|
|
|
# Create path to if doesn't exist, useful for when using secrets-init on another host
|
|
|
|
if [ ! -d "$SYSROOT/etc/NetworkManager/system-connections" ]; then
|
|
|
|
mkdir -p "$SYSROOT/etc/NetworkManager/system-connections"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cp ${./data/wifi-nmconnection.template} "$secretFile"
|
|
|
|
sed -i "s/WIFI_ID/Home-WiFi/" "$secretFile"
|
|
|
|
sed -i "s/WIFI_SSID/$ssid/" "$secretFile"
|
|
|
|
sed -i "s/WIFI_PASSWORD/$password/" "$secretFile"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|