about summary refs log tree commit diff
path: root/pkgs/tools/networking/slack-cli/wrapper.nix
blob: 3612aaa137ee66264b710f09164de47b2205ccfe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{ lib, writeShellScriptBin, curl, jq }:

slack-cli:

writeShellScriptBin "slack" ''
  [ "$1" = "init" -a -z "$SLACK_CLI_TOKEN" ] && cat >&2 <<-'MESSAGE'
  WARNING: slack-cli must be configured using the SLACK_CLI_TOKEN environment
  variable. Using `slack init` will not work because it tries to write to the
  Nix store.

  MESSAGE

  export PATH=${lib.makeBinPath [ curl jq ]}:"$PATH"
  exec ${slack-cli}/bin/slack "$@"
''