Add wake online

This commit is contained in:
2025-12-12 04:42:20 +01:00
parent 87993b83fe
commit 918d42ff71
8 changed files with 74 additions and 11 deletions

View File

@@ -0,0 +1,32 @@
{
config,
pkgs,
hostname,
...
}:
{
systemd.services."wol@$${config.my.lanInterface}" = {
description = "Wake-on-LAN for ${config.my.lanInterface}";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.ethtool}/bin/ethtool -s ${config.my.lanInterface} wol g";
RandomizedDelaySec = "30s";
};
};
environment.systemPackages = [ pkgs.ethtool ];
boot.initrd.network = {
enable = true;
ssh = {
enable = true;
port = 2222;
authorizedKeys = [ "ssh-ed25519 AAAA..." ]; # ta clé publique
hostKeys = [ "/etc/secrets/initrd/ssh_host_ed25519_key" ];
};
};
boot.kernelParams = [
"ip=192.168.0.2::192.168.0.254:255.255.255.0:${hostname}:${config.my.lanInterface}:off"
];
}