git-lfs: use buildGoModule

This commit is contained in:
Aaron Jheng 2022-06-04 03:14:28 +00:00
parent bd7aa1e1bf
commit 0b0119f1ea
No known key found for this signature in database
GPG key ID: F6A547A869D050A3

View file

@ -1,43 +1,56 @@
{ lib, buildGoPackage, fetchFromGitHub, ronn, installShellFiles }:
{ lib, buildGoModule, fetchFromGitHub, ronn, installShellFiles, git, testers, git-lfs }:
buildGoPackage rec {
buildGoModule rec {
pname = "git-lfs";
version = "3.2.0";
src = fetchFromGitHub {
rev = "v${version}";
owner = "git-lfs";
repo = "git-lfs";
rev = "v${version}";
sha256 = "sha256-3gVUPfZs5GViEA3D7Zm5NdxhuEz9DhwPLoQqHFdGCrI=";
leaveDotGit = true;
};
goPackagePath = "github.com/git-lfs/git-lfs";
vendorSha256 = null;
nativeBuildInputs = [ ronn installShellFiles ];
ldflags = [ "-s" "-w" "-X ${goPackagePath}/config.Vendor=${version}" "-X ${goPackagePath}/config.GitCommit=${src.rev}" ];
ldflags = [
"-s"
"-w"
"-X github.com/git-lfs/git-lfs/v${lib.versions.major version}/config.Vendor=${version}"
];
subPackages = [ "." ];
preBuild = ''
pushd go/src/github.com/git-lfs/git-lfs
go generate ./commands
popd
go generate ./commands
'';
postBuild = ''
make -C go/src/${goPackagePath} man
make man
'';
checkInputs = [ git ];
preCheck = ''
unset subPackages
'';
postInstall = ''
installManPage go/src/${goPackagePath}/man/man*/*
installManPage man/man*/*
'';
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 = [ maintainers.twey maintainers.marsam ];
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 marsam ];
};
}