at 23.11-beta 50 lines 1.5 kB view raw
1# slack-cli must be configured using the SLACK_CLI_TOKEN environment variable. 2# Using `slack init` will not work because it tries to write to the Nix store. 3# 4# There is no reason that we couldn't change the file path that slack-cli uses 5# for token storage, except that it would make the Nix package inconsistent with 6# upstream and other distributions. 7 8{ stdenv, lib, fetchFromGitHub, curl, jq, coreutils, gnugrep, gnused 9, runtimeShell }: 10 11stdenv.mkDerivation rec { 12 pname = "slack-cli"; 13 version = "0.18.0"; 14 15 src = fetchFromGitHub { 16 owner = "rockymadden"; 17 repo = "slack-cli"; 18 rev = "v${version}"; 19 sha256 = "022yr3cpfg0v7cxi62zzk08vp0l3w851qpfh6amyfgjiynnfyddl"; 20 }; 21 22 dontBuild = true; 23 24 installPhase = '' 25 mkdir -p "$out/bin" 26 cp src/slack "$out/bin/.slack-wrapped" 27 28 cat <<-WRAPPER > "$out/bin/slack" 29 #!${runtimeShell} 30 [ "\$1" = "init" -a -z "\$SLACK_CLI_TOKEN" ] && cat <<-'MESSAGE' >&2 31 WARNING: slack-cli must be configured using the SLACK_CLI_TOKEN 32 environment variable. Using \`slack init\` will not work because it tries 33 to write to the Nix store. 34 35 MESSAGE 36 37 export PATH=${lib.makeBinPath [ curl jq coreutils gnugrep gnused ]}:"\$PATH" 38 exec "$out/bin/.slack-wrapped" "\$@" 39 WRAPPER 40 41 chmod +x "$out/bin/slack" 42 ''; 43 44 meta = { 45 license = lib.licenses.mit; 46 maintainers = [ lib.maintainers.qyliss ]; 47 mainProgram = "slack"; 48 platforms = lib.platforms.unix; 49 }; 50}