about summary refs log tree commit diff
path: root/pkgs/applications/version-management/git-lfs/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/version-management/git-lfs/default.nix')
-rw-r--r--pkgs/applications/version-management/git-lfs/default.nix41
1 files changed, 27 insertions, 14 deletions
diff --git a/pkgs/applications/version-management/git-lfs/default.nix b/pkgs/applications/version-management/git-lfs/default.nix
index 936660cf7984a..b4f5a9e5287bd 100644
--- a/pkgs/applications/version-management/git-lfs/default.nix
+++ b/pkgs/applications/version-management/git-lfs/default.nix
@@ -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 ];
   };
 }