Commit 79dbe83f authored by kyehn's avatar kyehn
Browse files
parent cef1398c
Loading
Loading
Loading
Loading
+35 −23
Original line number Diff line number Diff line
{
  lib,
  buildGoModule,
  stdenv,
  buildGo124Module,
  fetchFromGitHub,
  testers,
  scip,
  libredirect,
  iana-etc,
  versionCheckHook,
}:

buildGoModule rec {
buildGo124Module (finalAttrs: {
  pname = "scip";
  version = "0.5.1";
  version = "0.6.0";

  src = fetchFromGitHub {
    owner = "sourcegraph";
    repo = "scip";
    rev = "v${version}";
    hash = "sha256-UXa5lMFenynHRIvA4MOXkjMVd705LBWs372s3MFAc+8=";
    tag = "v${finalAttrs.version}";
    hash = "sha256-ZyU1CmDBVDNP6zCXpvqEoQ3ttWNPGLCIjkj4mezUcKc=";
  };

  vendorHash = "sha256-6vx3Dt0ZNR0rY5bEUF5X1hHj/gv21920bhfd+JJ9bYk=";
  vendorHash = "sha256-RwBlzBqGd/xEaTL6m3sm6e/tcNUc7Mfdf213qzuMPug=";

  ldflags = [
    "-s"
@@ -25,25 +27,35 @@ buildGoModule rec {
    "-X=main.Reproducible=true"
  ];

  # update documentation to fix broken test
  postPatch = ''
    substituteInPlace docs/CLI.md \
      --replace 0.3.0 0.3.1
  nativeCheckInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libredirect.hook ];

  checkFlags =
    let
      skippedTests = [
        "TestParseCompat" # could not locate sample indexes directory starting from parents of working directory
        "TestParseSymbol_ZeroAllocationsIfMemoryAvailable"
      ];
    in
    [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];

  __darwinAllowLocalNetworking = true;

  preCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
    export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/services=${iana-etc}/etc/services
  '';

  passthru.tests = {
    version = testers.testVersion {
      package = scip;
      version = "v${version}";
    };
  };
  doInstallCheck = stdenv.hostPlatform.isLinux;

  nativeInstallCheckInputs = [ versionCheckHook ];

  versionCheckProgramArg = "--version";

  meta = with lib; {
  meta = {
    description = "SCIP Code Intelligence Protocol CLI";
    mainProgram = "scip";
    homepage = "https://github.com/sourcegraph/scip";
    changelog = "https://github.com/sourcegraph/scip/blob/${src.rev}/CHANGELOG.md";
    license = licenses.asl20;
    changelog = "https://github.com/sourcegraph/scip/blob/${finalAttrs.src.rev}/CHANGELOG.md";
    license = lib.licenses.asl20;
    maintainers = [  ];
  };
}
})