summary refs log tree commit diff
path: root/pkgs/applications/version-management/git-and-tools/hub/default.nix
blob: 46d33d1944ca669dcc8cb65d760d8aa558afd344 (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
{ stdenv, fetchgit, go, ronn, groff, utillinux, Security }:

stdenv.mkDerivation rec {
  name = "hub-${version}";
  version = "2.3.0";

  src = fetchgit {
    url = https://github.com/github/hub.git;
    rev = "refs/tags/v${version}";
    sha256 = "0rx5izxgjxh4jdn991x90xvgbc7nhwx15pkmmzc8rkdzf0hnas1s";
  };


  buildInputs = [ go ronn groff utillinux ]
    ++ stdenv.lib.optional stdenv.isDarwin Security;

  buildPhase = ''
    mkdir bin
    ln -s ${ronn}/bin/ronn bin/ronn

    patchShebangs .
    make all man-pages
  '';

  installPhase = ''
    prefix=$out sh -x < script/install.sh

    mkdir -p "$out/share/zsh/site-functions"
    cp "etc/hub.zsh_completion" "$out/share/zsh/site-functions/_hub"

    mkdir -p "$out/etc/bash_completion.d"
    cp "etc/hub.bash_completion.sh" "$out/etc/bash_completion.d/"

    # Should we also install provided git-hooks?
    # And fish completion?
  '';

  meta = with stdenv.lib; {
    description = "Command-line wrapper for git that makes you better at GitHub";

    license = licenses.mit;
    homepage = https://hub.github.com/;
    maintainers = with maintainers; [ the-kenny ];
    platforms = with platforms; unix;
  };
}