diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index ab9b6d76465..f05231f1553 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -3247,6 +3247,11 @@ github = "qoelet"; name = "Kenny Shen"; }; + qyliss = { + email = "hi@alyssa.is"; + github = "alyssais"; + name = "Alyssa Ross"; + }; ragge = { email = "r.dahlen@gmail.com"; github = "ragnard"; diff --git a/pkgs/tools/networking/slack-cli/default.nix b/pkgs/tools/networking/slack-cli/default.nix new file mode 100644 index 00000000000..18f192d3535 --- /dev/null +++ b/pkgs/tools/networking/slack-cli/default.nix @@ -0,0 +1,48 @@ +# 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. + +{ stdenv, lib, writeShellScriptBin, fetchFromGitHub, curl, jq }: + +stdenv.mkDerivation rec { + name = "slack-cli-${version}"; + 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" + #!${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 + + export PATH=${lib.makeBinPath [ curl jq ]}:"\$PATH" + exec "$out/bin/.slack-wrapped" "\$@" + WRAPPER + + chmod +x "$out/bin/slack" + ''; + + meta = { + license = lib.licenses.mit; + maintainers = [ lib.maintainers.qyliss ]; + platforms = lib.platforms.unix; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 82190c5b017..53378170716 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16704,6 +16704,8 @@ with pkgs; slack = callPackage ../applications/networking/instant-messengers/slack { }; + slack-cli = callPackage ../tools/networking/slack-cli { }; + singularity = callPackage ../applications/virtualization/singularity { }; spectrwm = callPackage ../applications/window-managers/spectrwm { };