Skip to content

Instantly share code, notes, and snippets.

@ento
Created December 14, 2023 21:34
Show Gist options
  • Save ento/96629e4e6b43d175ba27c30c8d772bd0 to your computer and use it in GitHub Desktop.
Save ento/96629e4e6b43d175ba27c30c8d772bd0 to your computer and use it in GitHub Desktop.

Revisions

  1. ento created this gist Dec 14, 2023.
    34 changes: 34 additions & 0 deletions slack-cli.nix
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    { lib, stdenv, fetchurl, ... }:
    let
    version = "2.11.0";
    platform = stdenv.hostPlatform;
    archive =
    if platform.isLinux then
    {
    url = "https://downloads.slack-edge.com/slack-cli/slack_cli_${version}_linux_64-bit.tar.gz";
    sha256 = "1sk6hb1m6j327fp8zlnw8bd8sni1wfwgc95wxqaxmr5gcg1fxqks";
    }
    else if platform.isDarwin then
    {
    url = "https://downloads.slack-edge.com/slack-cli/slack_cli_${version}_macOS_64-bit.tar.gz";
    sha256 = "0ln6mf66a2n8yysq2x721h0j4s403y3967mqkh7jjh19mx2823mq";
    }
    else throw "Unsupported platform ${platform}";
    in
    stdenv.mkDerivation rec {
    pname = "slack-cli";
    inherit version;

    src = fetchurl {
    inherit (archive) url sha256;
    };

    installPhase = ''
    mkdir -p $out/bin
    cp slack $out/bin/slack
    '';

    meta = {
    platforms = lib.platforms.unix;
    };
    }