nixpkgs/pkgs/by-name/gi/git-lfs/package.nix
2024-12-04 15:53:23 +01:00

77 lines
1.5 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
asciidoctor,
installShellFiles,
git,
testers,
git-lfs,
stdenv,
}:
buildGoModule rec {
pname = "git-lfs";
version = "3.6.0";
src = fetchFromGitHub {
owner = "git-lfs";
repo = "git-lfs";
rev = "v${version}";
hash = "sha256-PpNdbvtDAZDT43yyEkUvnhfUTAMM+mYImb3dVbAVPic=";
};
vendorHash = "sha256-JT0r/hs7ZRtsYh4aXy+v8BjwiLvRJ10e4yRirqmWVW0=";
nativeBuildInputs = [
asciidoctor
installShellFiles
];
ldflags = [
"-s"
"-w"
"-X github.com/git-lfs/git-lfs/v${lib.versions.major version}/config.Vendor=${version}"
];
subPackages = [ "." ];
preBuild = ''
GOARCH= go generate ./commands
'';
postBuild = ''
make man
'';
nativeCheckInputs = [ git ];
preCheck = ''
unset subPackages
'';
postInstall =
''
installManPage man/man*/*
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd git-lfs \
--bash <($out/bin/git-lfs completion bash) \
--fish <($out/bin/git-lfs completion fish) \
--zsh <($out/bin/git-lfs completion zsh)
'';
passthru.tests.version = testers.testVersion {
package = git-lfs;
};
meta = with lib; {
description = "Git extension for versioning large files";
homepage = "https://git-lfs.github.com/";
changelog = "https://github.com/git-lfs/git-lfs/raw/v${version}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ twey ];
mainProgram = "git-lfs";
};
}