mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat(chen): WoL
This commit is contained in:
parent
6cfaf82535
commit
81ae90dd12
12 changed files with 77 additions and 4 deletions
31
nixos/wake-chen.nix
Normal file
31
nixos/wake-chen.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (gensokyo-zone.lib) mapOptionDefaults;
|
||||
inherit (lib.meta) getExe;
|
||||
chen = gensokyo-zone.systems.chen.config;
|
||||
service = "wake-chen";
|
||||
in {
|
||||
systemd.services.${service} = {
|
||||
path = [ pkgs.wol ];
|
||||
script = ''
|
||||
exec wol ${chen.network.networks.local.macAddress}
|
||||
'';
|
||||
environment = mapOptionDefaults {
|
||||
WOL_MAC_ADDRESS = chen.network.networks.local.macAddress;
|
||||
};
|
||||
serviceConfig = mapOptionDefaults {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = false;
|
||||
} // {
|
||||
ExecStart = [
|
||||
"${getExe pkgs.wol} $WOL_MAC_ADDRESS"
|
||||
];
|
||||
};
|
||||
};
|
||||
services.systemd2mqtt.units = [ "${service}.service" ];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue