diff --git a/pkgs/applications/version-management/git-lfs/default.nix b/pkgs/applications/version-management/git-lfs/default.nix deleted file mode 100644 index 22ee1a17f218..000000000000 --- a/pkgs/applications/version-management/git-lfs/default.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ 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"; - }; -} diff --git a/pkgs/by-name/gi/git-lfs/package.nix b/pkgs/by-name/gi/git-lfs/package.nix new file mode 100644 index 000000000000..da5fa88179cc --- /dev/null +++ b/pkgs/by-name/gi/git-lfs/package.nix @@ -0,0 +1,115 @@ +{ + lib, + stdenv, + buildGoModule, + fetchFromGitHub, + asciidoctor, + installShellFiles, + git, + versionCheckHook, + nix-update-script, +}: + +buildGoModule rec { + pname = "git-lfs"; + version = "3.6.0"; + + src = fetchFromGitHub { + owner = "git-lfs"; + repo = "git-lfs"; + rev = "refs/tags/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 + ''; + + checkFlags = lib.optionals stdenv.hostPlatform.isDarwin ( + let + # Fail in the sandbox with network-related errors. + # Enabling __darwinAllowLocalNetworking is not enough. + skippedTests = [ + "TestAPIBatch" + "TestAPIBatchOnlyBasic" + "TestAuthErrWithBody" + "TestAuthErrWithoutBody" + "TestCertFromSSLCAInfoConfig" + "TestCertFromSSLCAInfoEnv" + "TestCertFromSSLCAInfoEnvWithSchannelBackend" + "TestCertFromSSLCAPathConfig" + "TestCertFromSSLCAPathEnv" + "TestClientRedirect" + "TestClientRedirectReauthenticate" + "TestDoAPIRequestWithAuth" + "TestDoWithAuthApprove" + "TestDoWithAuthNoRetry" + "TestDoWithAuthReject" + "TestFatalWithBody" + "TestFatalWithoutBody" + "TestHttp2" + "TestHttpVersion" + "TestWithNonFatal500WithBody" + "TestWithNonFatal500WithoutBody" + ]; + in + [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ] + ); + + 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) + ''; + + nativeInstallCheckInputs = [ + versionCheckHook + ]; + versionCheckProgramArg = [ "--version" ]; + doInstallCheck = true; + + passthru = { + updateScript = nix-update-script { }; + }; + + __darwinAllowLocalNetworking = true; + + meta = { + 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 = lib.licenses.mit; + maintainers = with lib.maintainers; [ twey ]; + mainProgram = "git-lfs"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4d1b16ac787e..f2a1810377b4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1243,8 +1243,6 @@ with pkgs; git-imerge = python3Packages.callPackage ../applications/version-management/git-imerge { }; - git-lfs = lowPrio (callPackage ../applications/version-management/git-lfs { }); - git-machete = python3Packages.callPackage ../applications/version-management/git-machete { }; git-ps-rs = callPackage ../development/tools/git-ps-rs {