NixOS deployment for LinuxLab
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
680 B

  1. { pkgs, lib, ... }:
  2. with lib;
  3. let
  4. awol = pkgs.writers.writeBashBin "awol" ''
  5. set -o errexit
  6. set -o nounset
  7. set -o pipefail
  8. ${concatMapStringsSep "\n\n"
  9. ({ name, value }: ''
  10. echo "Waking up client ${name}"
  11. ${pkgs.wakelan}/bin/wakelan \
  12. -b 10.32.44.255 \
  13. -m '${value.wol}'
  14. '')
  15. (attrsToList (import ../../clients.nix))}
  16. '';
  17. in
  18. {
  19. users.users."root".packages = [
  20. awol
  21. ];
  22. systemd.services."awol" = {
  23. description = "Prevent nodes from going AWOL";
  24. wants = [ "network.target" ];
  25. after = [ "network.target" ];
  26. script = "exec ${awol}/bin/awol";
  27. startAt = "minutely";
  28. };
  29. }