slack-cli: fix dirname hack
This commit is contained in:
parent
026f49e28c
commit
0e374a1b9c
@ -7,41 +7,42 @@
|
|||||||
|
|
||||||
{ stdenv, lib, writeShellScriptBin, fetchFromGitHub, curl, jq }:
|
{ stdenv, lib, writeShellScriptBin, fetchFromGitHub, curl, jq }:
|
||||||
|
|
||||||
let
|
stdenv.mkDerivation rec {
|
||||||
wrapper = writeShellScriptBin "slack" ''
|
name = "slack-cli-${version}";
|
||||||
[ "$1" = "init" -a -z "$SLACK_CLI_TOKEN" ] && cat >&2 <<-'MESSAGE'
|
version = "0.18.0";
|
||||||
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
|
src = fetchFromGitHub {
|
||||||
Nix store.
|
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"
|
||||||
|
#!${stdenv.shell}
|
||||||
|
[ "\$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.
|
||||||
|
|
||||||
MESSAGE
|
MESSAGE
|
||||||
|
|
||||||
export PATH=${lib.makeBinPath [ curl jq ]}:"$PATH"
|
export PATH=${lib.makeBinPath [ curl jq ]}:"\$PATH"
|
||||||
exec "$(dirname "$0")/.slack-wrapped" "$@"
|
exec "$out/bin/.slack-wrapped" "\$@"
|
||||||
|
WRAPPER
|
||||||
|
|
||||||
|
chmod +x "$out/bin/slack"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in stdenv.mkDerivation rec {
|
meta = {
|
||||||
name = "slack-cli-${version}";
|
license = lib.licenses.mit;
|
||||||
version = "0.18.0";
|
maintainers = [ lib.maintainers.qyliss ];
|
||||||
|
platforms = lib.platforms.unix;
|
||||||
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"
|
|
||||||
ln -s ${wrapper}/bin/slack "$out/bin/slack"
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
license = lib.licenses.mit;
|
|
||||||
maintainers = [ lib.maintainers.qyliss ];
|
|
||||||
platforms = lib.platforms.unix;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user