2018-08-15 13:56:19 +01:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# There is no reason that we couldn't change the file path that slack-cli uses
|
|
|
|
# for token storage, except that it would make the Nix package inconsistent with
|
|
|
|
# upstream and other distributions.
|
2018-08-15 09:56:04 +01:00
|
|
|
|
2020-06-29 08:03:49 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, curl, jq, coreutils, gnugrep, gnused
|
|
|
|
, runtimeShell }:
|
2018-08-15 09:56:04 +01:00
|
|
|
|
2018-08-15 16:53:11 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "slack-cli";
|
2018-08-15 16:53:11 +01:00
|
|
|
version = "0.18.0";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rockymadden";
|
|
|
|
repo = "slack-cli";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "022yr3cpfg0v7cxi62zzk08vp0l3w851qpfh6amyfgjiynnfyddl";
|
|
|
|
};
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
cp src/slack "$out/bin/.slack-wrapped"
|
|
|
|
|
|
|
|
cat <<-WRAPPER > "$out/bin/slack"
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2018-08-15 16:53:11 +01:00
|
|
|
[ "\$1" = "init" -a -z "\$SLACK_CLI_TOKEN" ] && cat <<-'MESSAGE' >&2
|
|
|
|
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.
|
2018-08-15 09:56:04 +01:00
|
|
|
|
2018-08-15 15:45:41 +01:00
|
|
|
MESSAGE
|
2018-08-15 09:56:04 +01:00
|
|
|
|
2020-06-29 08:03:49 +01:00
|
|
|
export PATH=${lib.makeBinPath [ curl jq coreutils gnugrep gnused ]}:"\$PATH"
|
2018-08-15 16:53:11 +01:00
|
|
|
exec "$out/bin/.slack-wrapped" "\$@"
|
|
|
|
WRAPPER
|
|
|
|
|
|
|
|
chmod +x "$out/bin/slack"
|
2018-08-15 09:56:04 +01:00
|
|
|
'';
|
2018-08-15 14:10:38 +01:00
|
|
|
|
2018-08-15 16:53:11 +01:00
|
|
|
meta = {
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = [ lib.maintainers.qyliss ];
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
};
|
|
|
|
}
|