1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-01-22 06:36:43 +00:00
nixpkgs/pkgs/applications/version-management/git-and-tools/hub/default.nix
Tim Steinbach 0576111e8a hub: Replace git references
Hub fetches git from the environment by default.
This can lead to hub installations without git available, which makes little sense.
The change replaces the references with fully-qualified calls to git
2021-01-02 15:43:01 -05:00

46 lines
1.4 KiB
Nix

{ stdenv, buildGoPackage, fetchFromGitHub, git, groff, installShellFiles, util-linux }:
buildGoPackage rec {
pname = "hub";
version = "2.14.2";
goPackagePath = "github.com/github/hub";
# Only needed to build the man-pages
excludedPackages = [ "github.com/github/hub/md2roff-bin" ];
src = fetchFromGitHub {
owner = "github";
repo = pname;
rev = "v${version}";
sha256 = "1qjab3dpia1jdlszz3xxix76lqrm4zbmqzd9ymld7h06awzsg2vh";
};
nativeBuildInputs = [ groff installShellFiles util-linux ];
postPatch = ''
patchShebangs .
substituteInPlace git/git.go --replace "cmd.New(\"git\")" "cmd.New(\"${git}/bin/git\")"
substituteInPlace commands/args.go --replace "Executable: \"git\"" "Executable: \"${git}/bin/git\""
'';
postInstall = ''
cd go/src/${goPackagePath}
installShellCompletion --zsh --name _hub etc/hub.zsh_completion
installShellCompletion --bash --name hub etc/hub.bash_completion.sh
installShellCompletion --fish --name hub.fish etc/hub.fish_completion
LC_ALL=C.UTF8 \
make man-pages
installManPage share/man/man[1-9]/*.[1-9]
'';
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; [ globin ];
platforms = with platforms; unix;
};
}