From 656f65c78eb6b2e72711acc35e2b936f4279238f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 2 Jun 2018 18:40:43 +0200 Subject: uucp-notifyclient --- custom/uucp-notifyclient.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 custom/uucp-notifyclient.nix (limited to 'custom/uucp-notifyclient.nix') diff --git a/custom/uucp-notifyclient.nix b/custom/uucp-notifyclient.nix new file mode 100644 index 00000000..373c0553 --- /dev/null +++ b/custom/uucp-notifyclient.nix @@ -0,0 +1,37 @@ +{ 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 ]; + }; +} -- cgit v1.2.3