From 4a13ac89587c2ec8c313538689264d1fa05267e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 18 Jul 2022 16:29:41 +0200 Subject: [PATCH] hub: 2.14.2 -> unstable-2022-04-04 Fetching https://github.com/github/hub/commit/5d42499f1da717ff39b7b1d4139f06f3a77a0612 didn't turn out to be that easy because the vendor/ directory was removed in the meantime and we would need to create a custom patch. Since the last release is over 2 years ago I opted into bumping it to the latest version in master instead. --- .../git-and-tools/hub/default.nix | 64 ++++++++++++------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/pkgs/applications/version-management/git-and-tools/hub/default.nix b/pkgs/applications/version-management/git-and-tools/hub/default.nix index 9d63642dcb33..cb75ec826464 100644 --- a/pkgs/applications/version-management/git-and-tools/hub/default.nix +++ b/pkgs/applications/version-management/git-and-tools/hub/default.nix @@ -1,47 +1,65 @@ -{ lib, buildGoPackage, fetchFromGitHub, git, groff, installShellFiles, unixtools, nixosTests }: +{ lib +, buildGoModule +, fetchpatch +, fetchFromGitHub +, git +, groff +, installShellFiles +, makeWrapper +, unixtools +, nixosTests +}: -buildGoPackage rec { +buildGoModule 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" ]; + version = "unstable-2022-04-04"; src = fetchFromGitHub { owner = "github"; repo = pname; - rev = "v${version}"; - sha256 = "1qjab3dpia1jdlszz3xxix76lqrm4zbmqzd9ymld7h06awzsg2vh"; + rev = "363513a0f822a8bde5b620e5de183702280d4ace"; + sha256 = "sha256-jipZHmGtPTsztTeVZofaMReU4AEU9k6mdw9YC4KKB1Q="; }; - nativeBuildInputs = [ groff installShellFiles unixtools.col ]; - 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\"" + patchShebangs script/ ''; + vendorSha256 = "sha256-wQH8V9jRgh45JGs4IfYS1GtmCIYdo93JG1UjJ0BGxXk="; + + # Only needed to build the man-pages + excludedPackages = [ "github.com/github/hub/md2roff-bin" ]; + + nativeBuildInputs = [ + groff + installShellFiles + makeWrapper + unixtools.col + ]; + 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 + installShellCompletion --cmd hub \ + --bash etc/hub.bash_completion.sh \ + --fish etc/hub.fish_completion \ + --zsh etc/hub.zsh_completion - LC_ALL=C.UTF8 \ - make man-pages + LC_ALL=C.UTF8 make man-pages installManPage share/man/man[1-9]/*.[1-9] + + wrapProgram $out/bin/hub \ + --suffix PATH : ${lib.makeBinPath [ git ]} ''; + checkInputs = [ + git + ]; + passthru.tests = { inherit (nixosTests) hub; }; meta = with lib; { description = "Command-line wrapper for git that makes you better at GitHub"; - license = licenses.mit; homepage = "https://hub.github.com/"; + license = licenses.mit; maintainers = with maintainers; [ globin ]; - platforms = with platforms; unix; }; }