{ config, lib, pkgs, ... }: with lib; let cfg = config.services.uucp.notify-client; nodeConfig = { options = { allowedUsers = mkOption { type = with types; uniq (listOf str); default = services.notify-users.allowedUsers; }; }; }; in { options = { services.uucp.notify-client = mkOption { remoteNodes = mkOption { type = with types; attrsOf (submodule nodeConfig); default = []; description = '' Servers to receive notifications from ''; }; }; }; imports = [ ./notify-users.nix ]; config = mkIf (cfg.nodes != {}) { services.notify-users = concatMap ({ allowedUsers }: allowedUsers) cfg.remoteNodes; services.uucp.remoteNodes = mapAttrs (name: { allowedUsers }: { commands = map (user: "notify-${user}") allowedUsers; }) cfg.remoteNodes; services.uucp.commandPath = [ config.security.wrapperDir ]; }; }