nixpkgs/pkgs/applications/version-management/git-town/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

78 lines
2.1 KiB
Nix
Raw Normal View History

{ lib, buildGoModule, fetchFromGitHub, fetchpatch, installShellFiles, git, testers, git-town, makeWrapper }:
2022-06-04 06:49:53 +00:00
buildGoModule rec {
2020-04-02 06:43:26 +00:00
pname = "git-town";
version = "7.8.0";
2020-04-02 06:43:26 +00:00
src = fetchFromGitHub {
2020-09-02 01:44:48 +00:00
owner = "git-town";
2020-04-02 06:43:26 +00:00
repo = "git-town";
rev = "v${version}";
sha256 = "sha256-g9ooMIMN8DN2FcWYkDC1hICCleQYdHf30PYMCit/NMI=";
2020-04-02 06:43:26 +00:00
};
patches = [
# Fix "go vet" when building using Go 1.18.
(fetchpatch {
name = "fix-go-vet-in-go-1.18.patch";
url = "https://github.com/git-town/git-town/commit/23eb0aca7b28c6a0afc21db553aa0e35d35891aa.patch";
sha256 = "sha256-EyfhKVrQxRJNrYqaZI04dJogaXs1J+bbOIu7p8g2Clc=";
})
];
2022-06-04 06:49:53 +00:00
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; {
2020-04-02 06:43:26 +00:00
description = "Generic, high-level git support for git-flow workflows";
homepage = "https://www.git-town.com/";
2020-04-02 06:43:26 +00:00
license = licenses.mit;
2022-06-04 06:49:53 +00:00
maintainers = with maintainers; [ allonsy blaggacao ];
2020-04-02 06:43:26 +00:00
};
}