nixpkgs/pkgs/by-name/gi/git-town/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

75 lines
1.8 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, installShellFiles, git, testers, git-town, makeWrapper }:
buildGoModule rec {
pname = "git-town";
version = "16.4.1";
src = fetchFromGitHub {
owner = "git-town";
repo = "git-town";
rev = "v${version}";
hash = "sha256-8Xr1R6txsJBGzBtvvKOCg2lcAHksl4hNPc9zySkTfdg=";
};
vendorHash = 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"
];
nativeCheckInputs = [ git ];
preCheck = ''
HOME=$(mktemp -d)
# this runs tests requiring local operations
rm main_test.go
'';
checkFlags =
let
# Disable tests requiring local operations
skippedTests = [
"TestGodog"
"TestMockingRunner/MockCommand"
"TestMockingRunner/QueryWith"
"TestTestCommands/CreateChildFeatureBranch"
];
in
[ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
postInstall = ''
installShellCompletion --cmd git-town \
--bash <($out/bin/git-town completions bash) \
--fish <($out/bin/git-town completions fish) \
--zsh <($out/bin/git-town completions zsh)
wrapProgram $out/bin/git-town --prefix PATH : ${lib.makeBinPath [ git ]}
'';
passthru.tests.version = testers.testVersion {
package = git-town;
command = "git-town --version";
inherit version;
};
meta = with lib; {
description = "Generic, high-level git support for git-flow workflows";
homepage = "https://www.git-town.com/";
license = licenses.mit;
maintainers = with maintainers; [ allonsy blaggacao gabyx ];
mainProgram = "git-town";
};
}