{ pkgs, lib, ... }: with lib; let awol = pkgs.writers.writeBashBin "awol" '' set -o errexit set -o nounset set -o pipefail ${concatMapStringsSep "\n\n" ({ name, value }: '' echo "Waking up client ${name}" ${pkgs.wakelan}/bin/wakelan \ -b 10.32.44.255 \ -m '${value.wol}' '') (attrsToList (import ../../clients.nix))} ''; in { users.users."root".packages = [ awol ]; systemd.services."awol" = { description = "Prevent nodes from going AWOL"; wants = [ "network.target" ]; after = [ "network.target" ]; script = "exec ${awol}/bin/awol"; startAt = "5 minutes"; }; }