dotfiles/modules/nixos/services/identity.nix

23 lines
517 B
Nix
Raw Normal View History

2024-03-24 17:16:20 +00:00
{ config, ... }: {
# Wait for secret to be placed on the machine
systemd.services.wait-for-identity = {
description = "Wait until identity file exists on the machine";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
2024-03-24 17:16:20 +00:00
script = ''
2024-03-24 19:15:07 +00:00
for i in $(seq 1 10); do
2024-03-24 17:16:20 +00:00
if [ -f ${config.identityFile} ]; then
echo "Identity file found."
exit 0
fi
2024-03-24 19:15:07 +00:00
sleep 6
2024-03-24 17:16:20 +00:00
done
'';
};
}