33 lines
828 B
Nix
33 lines
828 B
Nix
{
|
|
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"
|
|
];
|
|
}
|