summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/irc-announce/default.nix
blob: 7b2af030713c6dccd91fe7381fa17ae03982d873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{ pkgs, lib, ... }:

pkgs.writeDashBin "irc-announce" ''
  set -euf

  IRC_SERVER=$1
  IRC_PORT=$2
  IRC_NICK=$3_$$
  IRC_CHANNEL=$4
  IRC_TLS=$5
  message=$6

  if test "$IRC_TLS" != 1; then
    unset IRC_TLS
  fi

  printf %s "$message" |
  ${pkgs.ircaids}/bin/ircsink \
      --nick="$IRC_NICK" \
      --port="$IRC_PORT" \
      --server="$IRC_SERVER" \
      --target="$IRC_CHANNEL" \
      ''${IRC_TLS:+--secure}
''