diff options
author | Alyssa Ross <hi@alyssa.is> | 2018-08-15 15:45:41 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2018-08-15 15:48:23 +0100 |
commit | 026f49e28c535ad04a54d689c773275a7ab99f9f (patch) | |
tree | c6646516db0deab9ba972bc91b160b97a3bc07fa | |
parent | 0a57de6f5b138ab99bfb72efae742a715f46c46e (diff) |
slack-cli: remove wrapper package
-rw-r--r-- | pkgs/tools/networking/slack-cli/default.nix | 56 | ||||
-rw-r--r-- | pkgs/tools/networking/slack-cli/wrapper.nix | 21 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 4 |
3 files changed, 36 insertions, 45 deletions
diff --git a/pkgs/tools/networking/slack-cli/default.nix b/pkgs/tools/networking/slack-cli/default.nix index 24d8278246616..dc8b25d868c8f 100644 --- a/pkgs/tools/networking/slack-cli/default.nix +++ b/pkgs/tools/networking/slack-cli/default.nix @@ -5,29 +5,43 @@ # for token storage, except that it would make the Nix package inconsistent with # upstream and other distributions. -{ stdenv, fetchFromGitHub }: +{ stdenv, lib, writeShellScriptBin, fetchFromGitHub, curl, jq }: -stdenv.mkDerivation rec { - name = "slack-cli-${version}"; - version = "0.18.0"; +let + wrapper = writeShellScriptBin "slack" '' + [ "$1" = "init" -a -z "$SLACK_CLI_TOKEN" ] && cat >&2 <<-'MESSAGE' + 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. - src = fetchFromGitHub { - owner = "rockymadden"; - repo = "slack-cli"; - rev = "v${version}"; - sha256 = "022yr3cpfg0v7cxi62zzk08vp0l3w851qpfh6amyfgjiynnfyddl"; - }; + MESSAGE - dontBuild = true; - - installPhase = '' - mkdir -p "$out/bin" - cp src/slack "$out/bin" + export PATH=${lib.makeBinPath [ curl jq ]}:"$PATH" + exec "$(dirname "$0")/.slack-wrapped" "$@" ''; - meta = { - license = stdenv.lib.licenses.mit; - maintainers = [ stdenv.lib.maintainers.qyliss ]; - platforms = stdenv.lib.platforms.unix; - }; -} +in 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" + ln -s ${wrapper}/bin/slack "$out/bin/slack" + ''; + + meta = { + license = lib.licenses.mit; + maintainers = [ lib.maintainers.qyliss ]; + platforms = lib.platforms.unix; + }; + } diff --git a/pkgs/tools/networking/slack-cli/wrapper.nix b/pkgs/tools/networking/slack-cli/wrapper.nix deleted file mode 100644 index f31553bda37fc..0000000000000 --- a/pkgs/tools/networking/slack-cli/wrapper.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ lib, writeShellScriptBin, curl, jq }: - -slack-cli: - -(writeShellScriptBin "slack" '' - [ "$1" = "init" -a -z "$SLACK_CLI_TOKEN" ] && cat >&2 <<-'MESSAGE' - 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 ${slack-cli}/bin/slack "$@" -'') // { - unwrapped = slack-cli; - - meta = slack-cli.meta; - name = slack-cli.name; - version = slack-cli.version; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f53b144cee9d7..c2f1f212a5204 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16695,9 +16695,7 @@ with pkgs; slack = callPackage ../applications/networking/instant-messengers/slack { }; - wrapSlackCli = callPackage ../tools/networking/slack-cli/wrapper.nix { }; - slack-cli-unwrapped = callPackage ../tools/networking/slack-cli { }; - slack-cli = wrapSlackCli slack-cli-unwrapped; + slack-cli = callPackage ../tools/networking/slack-cli { }; singularity = callPackage ../applications/virtualization/singularity { }; |