Syndev
Summary
Syndev is a uevent manager similar to Mdev, Mdevd, or Udev. Syndev observes Linux kernel uevents like a typical hardware manager however Syndev is not a replacement for these because it does not execute event handers on its own. Syndev should be used instead as a secondary manager that subscribes to rebroadcasts from a primary Mdevd instance.
Syndev is in fact a single utitility named
uevent-dump.
SLAM
Syndev is configured by the /services/syndev module and
the services.syndev options.
{ config, lib, pkgs, slamPath, ...}:
{
imports = [ (slamPath + /services/syndev) ];
services.mdevd = {
# Rebroadcast uevents on nlgroups 2 & 4.
# Libudev-zero observes group 4.
# These groups are specified as a combined bitmask.
nlgroups = 6;
};
services.syndev = {
enable = true;
# Observe uevents on nlgroup 2.
nlgroup = 2;
};
synit.plan.config.powerSupplyHandler = ''
# Observe the uevents dataspace being made available.
? <bind <oid uevents> ?ue> [
let ?mainsOfflineAttrs = {
POWER_SUPPLY_ONLINE: 0
POWER_SUPPLY_TYPE: "Mains"
}
$ue ?? <uevent "power_supply" _ _ $mainsOfflineAttrs > [
# Fire a message into the main dataspace.
$config ! <power-offline>
]
let ?mainsOnlineAttrs = {
POWER_SUPPLY_ONLINE: 1
POWER_SUPPLY_TYPE: "Mains"
}
$ue ?? <uevent "power_supply" _ _ $mainsOnlineAttrs > [
# Fire a message into the main dataspace.
$config ! <power-restored>
]
]
'';
}