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
681 B
37 lines
681 B
{ 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";
|
|
};
|
|
}
|
|
|