Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 67 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{ 9 stdenv, 10 lib, 11 fetchFromGitHub, 12 curl, 13 jq, 14 coreutils, 15 gnugrep, 16 gnused, 17 runtimeShell, 18}: 19 20stdenv.mkDerivation rec { 21 pname = "slack-cli"; 22 version = "0.18.0"; 23 24 src = fetchFromGitHub { 25 owner = "rockymadden"; 26 repo = "slack-cli"; 27 rev = "v${version}"; 28 sha256 = "022yr3cpfg0v7cxi62zzk08vp0l3w851qpfh6amyfgjiynnfyddl"; 29 }; 30 31 dontBuild = true; 32 33 installPhase = '' 34 mkdir -p "$out/bin" 35 cp src/slack "$out/bin/.slack-wrapped" 36 37 cat <<-WRAPPER > "$out/bin/slack" 38 #!${runtimeShell} 39 [ "\$1" = "init" -a -z "\$SLACK_CLI_TOKEN" ] && cat <<-'MESSAGE' >&2 40 WARNING: slack-cli must be configured using the SLACK_CLI_TOKEN 41 environment variable. Using \`slack init\` will not work because it tries 42 to write to the Nix store. 43 44 MESSAGE 45 46 export PATH=${ 47 lib.makeBinPath [ 48 curl 49 jq 50 coreutils 51 gnugrep 52 gnused 53 ] 54 }:"\$PATH" 55 exec "$out/bin/.slack-wrapped" "\$@" 56 WRAPPER 57 58 chmod +x "$out/bin/slack" 59 ''; 60 61 meta = { 62 license = lib.licenses.mit; 63 maintainers = [ ]; 64 mainProgram = "slack"; 65 platforms = lib.platforms.unix; 66 }; 67}