dotfiles/modules/nixos/services/identity.nix
2024-03-24 15:15:07 -04:00

20 lines
477 B
Nix

{ 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"; };
script = ''
for i in $(seq 1 10); do
if [ -f ${config.identityFile} ]; then
echo "Identity file found."
exit 0
fi
sleep 6
done
'';
};
}