1{ stdenv, lib, fetchurl, makeWrapper, buildGoPackage, fetchFromGitHub
2, nodejs-6_x, postgresql, ruby }:
3
4with stdenv.lib;
5
6let
7 cli = buildGoPackage rec {
8 name = "cli-${version}";
9 version = "5.6.32";
10
11 goPackagePath = "github.com/heroku/cli";
12
13 src = fetchFromGitHub {
14 owner = "heroku";
15 repo = "cli";
16 rev = "v${version}";
17 sha256 = "062aa79mv2njjb0ix7isbz6646wxmsldv27bsz5v2pbv597km0vz";
18 };
19
20 buildFlagsArray = ''
21 -ldflags=
22 -X=main.Version=${version}
23 -X=main.Channel=stable
24 -X=main.Autoupdate=no
25 '';
26
27 preCheck = ''
28 export HOME=/tmp
29 '';
30
31 doCheck = true;
32 };
33
34in stdenv.mkDerivation rec {
35 name = "heroku-${version}";
36 version = "3.43.16";
37
38 meta = {
39 homepage = https://toolbelt.heroku.com;
40 description = "Everything you need to get started using Heroku";
41 maintainers = with maintainers; [ aflatter mirdhyn peterhoeg ];
42 license = licenses.mit;
43 platforms = with platforms; unix;
44 broken = true; # Outdated function, not supported upstream. https://github.com/NixOS/nixpkgs/issues/27447
45 };
46
47 binPath = lib.makeBinPath [ postgresql ruby ];
48
49 buildInputs = [ makeWrapper ];
50
51 doUnpack = false;
52
53 src = fetchurl {
54 url = "https://s3.amazonaws.com/assets.heroku.com/heroku-client/heroku-client-${version}.tgz";
55 sha256 = "08pai3cjaj7wshhyjcmkvyr1qxv5ab980whcm406798ng8f91hn7";
56 };
57
58 installPhase = ''
59 mkdir -p $out
60
61 tar xzf $src -C $out --strip-components=1
62 install -Dm755 ${cli}/bin/cli $out/share/heroku/cli/bin/heroku
63
64 wrapProgram $out/bin/heroku \
65 --set HEROKU_NODE_PATH ${nodejs-6_x}/bin/node \
66 --set XDG_DATA_HOME $out/share \
67 --set XDG_DATA_DIRS $out/share \
68 --prefix PATH : ${binPath}
69 '';
70}