Merge pull request #176200 from aaronjheng/git-town

git-town: use buildGoModule
This commit is contained in:
superherointj 2022-07-06 21:54:47 -03:00 committed by GitHub
commit e8bd76819f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,10 +1,9 @@
{ lib, buildGoPackage, fetchFromGitHub }:
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, git, testers, git-town, makeWrapper }:
buildGoPackage rec {
buildGoModule rec {
pname = "git-town";
version = "7.7.0";
goPackagePath = "github.com/git-town/git-town";
src = fetchFromGitHub {
owner = "git-town";
repo = "git-town";
@ -12,12 +11,58 @@ buildGoPackage rec {
sha256 = "sha256-FpBEBx2gb33fGDndvZmvG1A61NoJ4Qy4V3YQSb+Ugsc=";
};
ldflags = [ "-X github.com/git-town/git-town/src/cmd.version=v${version}" "-X github.com/git-town/git-town/src/cmd.buildDate=nix" ];
vendorSha256 = null;
nativeBuildInputs = [ installShellFiles makeWrapper ];
buildInputs = [ git ];
ldflags =
let
modulePath = "github.com/git-town/git-town/v${lib.versions.major version}"; in
[
"-s"
"-w"
"-X ${modulePath}/src/cmd.version=v${version}"
"-X ${modulePath}/src/cmd.buildDate=nix"
];
checkInputs = [ git ];
preCheck =
let
skippedTests = [
"TestGodog"
"TestRunner_CreateChildFeatureBranch"
"TestShellRunner_RunStringWith_Dir"
"TestMockingShell_MockCommand"
"TestShellRunner_RunStringWith_Input"
];
in
''
HOME=$(mktemp -d)
# Disable tests requiring local operations
buildFlagsArray+=("-run" "[^(${builtins.concatStringsSep "|" skippedTests})]")
'';
postInstall = ''
installShellCompletion --cmd git-town \
--bash <($out/bin/git-town completion bash) \
--fish <($out/bin/git-town completion fish) \
--zsh <($out/bin/git-town completion zsh)
wrapProgram $out/bin/git-town --prefix PATH : ${lib.makeBinPath [ git ]}
'';
passthru.tests.version = testers.testVersion {
package = git-town;
command = "git-town version";
version = "v${version}";
};
meta = with lib; {
description = "Generic, high-level git support for git-flow workflows";
homepage = "https://www.git-town.com/";
maintainers = [ maintainers.allonsy maintainers.blaggacao ];
license = licenses.mit;
maintainers = with maintainers; [ allonsy blaggacao ];
};
}