about summary refs log tree commit diff
path: root/pkgs/development/tools/heroku/default.nix
blob: f9c43ee841bac4e083d6827a80901fd22c30fbde (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ stdenv, lib, fetchurl, makeWrapper, buildGoPackage, fetchFromGitHub
, nodejs-6_x, postgresql, ruby }:

with stdenv.lib;

let
  cli = buildGoPackage rec {
    name = "cli-${version}";
    version = "5.6.14";

    goPackagePath = "github.com/heroku/cli";

    src = fetchFromGitHub {
      owner  = "heroku";
      repo   = "cli";
      rev    = "v${version}";
      sha256 = "11jccham1vkmh5284l6i30na4a4y7b1jhi2ci2z2wwx8m3gkypq9";
    };
  };

in stdenv.mkDerivation rec {
  name = "heroku-${version}";
  version = "3.43.16";

  meta = {
    homepage = "https://toolbelt.heroku.com";
    description = "Everything you need to get started using Heroku";
    maintainers = with maintainers; [ aflatter mirdhyn peterhoeg ];
    license = licenses.mit;
    platforms = with platforms; unix;
  };

  binPath = lib.makeBinPath [ postgresql ruby ];

  buildInputs = [ makeWrapper ];

  doUnpack = false;

  src = fetchurl {
    url = "https://s3.amazonaws.com/assets.heroku.com/heroku-client/heroku-client-${version}.tgz";
    sha256 = "08pai3cjaj7wshhyjcmkvyr1qxv5ab980whcm406798ng8f91hn7";
  };

  installPhase = ''
    mkdir -p $out

    tar xzf $src -C $out --strip-components=1
    install -Dm755 ${cli}/bin/cli $out/share/heroku/cli/bin/heroku

    wrapProgram $out/bin/heroku \
      --set HEROKU_NODE_PATH ${nodejs-6_x}/bin/node \
      --set XDG_DATA_HOME    $out/share \
      --set XDG_DATA_DIRS    $out/share \
      --prefix PATH : ${binPath}
  '';
}