2022-07-18 16:29:41 +02:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchpatch
|
|
|
|
, fetchFromGitHub
|
|
|
|
, git
|
|
|
|
, groff
|
|
|
|
, installShellFiles
|
|
|
|
, makeWrapper
|
|
|
|
, unixtools
|
|
|
|
, nixosTests
|
|
|
|
}:
|
2012-12-12 06:45:43 +01:00
|
|
|
|
2022-07-18 16:29:41 +02:00
|
|
|
buildGoModule rec {
|
2019-02-17 17:54:29 +01:00
|
|
|
pname = "hub";
|
2023-02-22 08:17:21 +01:00
|
|
|
version = "unstable-2022-12-01";
|
2019-02-17 17:54:29 +01:00
|
|
|
|
2018-06-22 00:12:52 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "github";
|
2019-02-17 17:54:29 +01:00
|
|
|
repo = pname;
|
2023-02-22 08:17:21 +01:00
|
|
|
rev = "38bcd4ae469e5f53f01901340b715c7658ab417a";
|
|
|
|
hash = "sha256-V2GvwKj0m2UXxE42G23OHXyAsTrVRNw1p5CAaJxGYog=";
|
2012-12-12 06:45:43 +01:00
|
|
|
};
|
|
|
|
|
2023-02-22 08:17:21 +01:00
|
|
|
patches = [
|
|
|
|
# Fix `fish` completions
|
2023-10-01 18:13:30 +02:00
|
|
|
# https://github.com/github/hub/pull/3036
|
2023-02-22 08:17:21 +01:00
|
|
|
(fetchpatch {
|
2023-10-01 18:13:30 +02:00
|
|
|
url = "https://github.com/github/hub/commit/439b7699e79471fc789929bcdea2f30bd719963e.patch";
|
2023-02-22 08:17:21 +01:00
|
|
|
hash = "sha256-pR/OkGa2ICR4n1pLNx8E2UTtLeDwFtXxeeTB94KFjC4=";
|
|
|
|
})
|
|
|
|
# Fix `bash` completions
|
2023-10-01 18:13:30 +02:00
|
|
|
# https://github.com/github/hub/pull/2948
|
2023-02-22 08:17:21 +01:00
|
|
|
(fetchpatch {
|
2023-10-01 18:13:30 +02:00
|
|
|
url = "https://github.com/github/hub/commit/64b291006f208fc7db1d5be96ff7db5535f1d853.patch";
|
2023-02-22 08:17:21 +01:00
|
|
|
hash = "sha256-jGFFIvSKEIpTQY0Wz63cqciUk25MzPHv5Z1ox8l7wmo=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2018-06-22 00:12:52 +02:00
|
|
|
postPatch = ''
|
2022-07-18 16:29:41 +02:00
|
|
|
patchShebangs script/
|
2023-02-22 08:17:21 +01:00
|
|
|
sed -i 's/^var Version = "[^"]\+"$/var Version = "${version}"/' version/version.go
|
2012-12-12 06:45:43 +01:00
|
|
|
'';
|
|
|
|
|
2023-02-22 08:17:21 +01:00
|
|
|
vendorHash = "sha256-wQH8V9jRgh45JGs4IfYS1GtmCIYdo93JG1UjJ0BGxXk=";
|
2022-07-18 16:29:41 +02:00
|
|
|
|
|
|
|
# Only needed to build the man-pages
|
|
|
|
excludedPackages = [ "github.com/github/hub/md2roff-bin" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
groff
|
|
|
|
installShellFiles
|
|
|
|
makeWrapper
|
|
|
|
unixtools.col
|
|
|
|
];
|
|
|
|
|
2018-06-22 00:12:52 +02:00
|
|
|
postInstall = ''
|
2022-07-18 16:29:41 +02:00
|
|
|
installShellCompletion --cmd hub \
|
|
|
|
--bash etc/hub.bash_completion.sh \
|
|
|
|
--fish etc/hub.fish_completion \
|
|
|
|
--zsh etc/hub.zsh_completion
|
2015-01-04 00:28:38 +01:00
|
|
|
|
2022-07-18 16:29:41 +02:00
|
|
|
LC_ALL=C.UTF8 make man-pages
|
2020-04-26 05:16:53 +02:00
|
|
|
installManPage share/man/man[1-9]/*.[1-9]
|
2022-07-18 16:29:41 +02:00
|
|
|
|
|
|
|
wrapProgram $out/bin/hub \
|
|
|
|
--suffix PATH : ${lib.makeBinPath [ git ]}
|
2012-12-12 06:45:43 +01:00
|
|
|
'';
|
|
|
|
|
2023-01-21 13:00:00 +01:00
|
|
|
nativeCheckInputs = [
|
2022-07-18 16:29:41 +02:00
|
|
|
git
|
|
|
|
];
|
|
|
|
|
2020-12-29 17:13:26 +01:00
|
|
|
passthru.tests = { inherit (nixosTests) hub; };
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2015-01-04 00:28:38 +01:00
|
|
|
description = "Command-line wrapper for git that makes you better at GitHub";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://hub.github.com/";
|
2022-07-18 16:29:41 +02:00
|
|
|
license = licenses.mit;
|
2020-05-09 11:25:07 +02:00
|
|
|
maintainers = with maintainers; [ globin ];
|
2012-12-12 06:45:43 +01:00
|
|
|
};
|
|
|
|
}
|