bitwarden-desktop: 2024.12.1 -> 2025.1.1 (#374021)
[NixPkgs.git] / pkgs / by-name / hu / hub / package.nix
blob71c302369fb425ede535cbf55961686edc3a95b8
2   lib,
3   buildGoModule,
4   fetchpatch,
5   fetchFromGitHub,
6   git,
7   groff,
8   installShellFiles,
9   makeWrapper,
10   unixtools,
11   nixosTests,
14 buildGoModule rec {
15   pname = "hub";
16   version = "unstable-2022-12-01";
18   src = fetchFromGitHub {
19     owner = "github";
20     repo = pname;
21     rev = "38bcd4ae469e5f53f01901340b715c7658ab417a";
22     hash = "sha256-V2GvwKj0m2UXxE42G23OHXyAsTrVRNw1p5CAaJxGYog=";
23   };
25   patches = [
26     # Fix `fish` completions
27     # https://github.com/github/hub/pull/3036
28     (fetchpatch {
29       url = "https://github.com/github/hub/commit/439b7699e79471fc789929bcdea2f30bd719963e.patch";
30       hash = "sha256-pR/OkGa2ICR4n1pLNx8E2UTtLeDwFtXxeeTB94KFjC4=";
31     })
32     # Fix `bash` completions
33     # https://github.com/github/hub/pull/2948
34     (fetchpatch {
35       url = "https://github.com/github/hub/commit/64b291006f208fc7db1d5be96ff7db5535f1d853.patch";
36       hash = "sha256-jGFFIvSKEIpTQY0Wz63cqciUk25MzPHv5Z1ox8l7wmo=";
37     })
38   ];
40   postPatch = ''
41     patchShebangs script/
42     sed -i 's/^var Version = "[^"]\+"$/var Version = "${version}"/' version/version.go
43   '';
45   vendorHash = "sha256-wQH8V9jRgh45JGs4IfYS1GtmCIYdo93JG1UjJ0BGxXk=";
47   # Only needed to build the man-pages
48   excludedPackages = [ "github.com/github/hub/md2roff-bin" ];
50   nativeBuildInputs = [
51     groff
52     installShellFiles
53     makeWrapper
54     unixtools.col
55   ];
57   postInstall = ''
58     installShellCompletion --cmd hub \
59       --bash etc/hub.bash_completion.sh \
60       --fish etc/hub.fish_completion \
61       --zsh etc/hub.zsh_completion
63     LC_ALL=C.UTF8 make man-pages
64     installManPage share/man/man[1-9]/*.[1-9]
66     wrapProgram $out/bin/hub \
67       --suffix PATH : ${lib.makeBinPath [ git ]}
68   '';
70   nativeCheckInputs = [
71     git
72   ];
74   passthru.tests = { inherit (nixosTests) hub; };
76   meta = with lib; {
77     description = "Command-line wrapper for git that makes you better at GitHub";
78     homepage = "https://hub.github.com/";
79     license = licenses.mit;
80     maintainers = with maintainers; [ globin ];
81   };