diff options
Diffstat (limited to 'custom/uucp-notifyclient.nix')
| -rw-r--r-- | custom/uucp-notifyclient.nix | 37 |
1 files changed, 37 insertions, 0 deletions
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 @@ | |||
| 1 | { config, lib, pkgs, ... }: | ||
| 2 | |||
| 3 | with lib; | ||
| 4 | |||
| 5 | let | ||
| 6 | cfg = config.services.uucp.notify-client; | ||
| 7 | |||
| 8 | nodeConfig = { | ||
| 9 | options = { | ||
| 10 | allowedUsers = mkOption { | ||
| 11 | type = with types; uniq (listOf str); | ||
| 12 | default = services.notify-users.allowedUsers; | ||
| 13 | }; | ||
| 14 | }; | ||
| 15 | }; | ||
| 16 | in { | ||
| 17 | options = { | ||
| 18 | services.uucp.notify-client = mkOption { | ||
| 19 | remoteNodes = mkOption { | ||
| 20 | type = with types; attrsOf (submodule nodeConfig); | ||
| 21 | default = []; | ||
| 22 | description = '' | ||
| 23 | Servers to receive notifications from | ||
| 24 | ''; | ||
| 25 | }; | ||
| 26 | }; | ||
| 27 | }; | ||
| 28 | |||
| 29 | imports = [ ./notify-users.nix ]; | ||
| 30 | |||
| 31 | config = mkIf (cfg.nodes != {}) { | ||
| 32 | services.notify-users = concatMap ({ allowedUsers }: allowedUsers) cfg.remoteNodes; | ||
| 33 | |||
| 34 | services.uucp.remoteNodes = mapAttrs (name: { allowedUsers }: { commands = map (user: "notify-${user}") allowedUsers; }) cfg.remoteNodes; | ||
| 35 | services.uucp.commandPath = [ config.security.wrapperDir ]; | ||
| 36 | }; | ||
| 37 | } | ||
