Unverified Commit 6840a894 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

treewide: use `versionCheckHook` (#404005)

parents b3991179 b0e31408
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -2,20 +2,22 @@
  lib,
  buildGoModule,
  fetchFromGitHub,
  versionCheckHook,
}:

buildGoModule rec {
buildGoModule (finalAttrs: {
  pname = "atlantis";
  version = "0.34.0";

  src = fetchFromGitHub {
    owner = "runatlantis";
    repo = "atlantis";
    rev = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-2xgU3H6X9EcbySV9RXN5oCn+7EkfdwebeYsL5+Vl69E=";
  };

  ldflags = [
    "-X=main.version=${version}"
    "-X=main.version=${finalAttrs.version}"
    "-X=main.date=1970-01-01T00:00:00Z"
  ];

@@ -24,15 +26,15 @@ buildGoModule rec {
  subPackages = [ "." ];

  doInstallCheck = true;
  installCheckPhase = ''
    $out/bin/atlantis version | grep ${version} > /dev/null
  '';
  nativeInstallCheckInputs = [ versionCheckHook ];
  versionCheckProgram = "${placeholder "out"}/bin/atlantis";
  versionCheckProgramArg = "version";

  meta = with lib; {
  meta = {
    homepage = "https://github.com/runatlantis/atlantis";
    description = "Terraform Pull Request Automation";
    mainProgram = "atlantis";
    license = licenses.asl20;
    maintainers = with maintainers; [ jpotier ];
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ jpotier ];
  };
}
})
+11 −11
Original line number Diff line number Diff line
@@ -4,23 +4,24 @@
  rustPlatform,
  fetchFromGitHub,
  installShellFiles,
  makeWrapper,
  makeBinaryWrapper,
  pkg-config,
  libgit2,
  zlib,
  buildPackages,
  versionCheckHook,
  withClipboard ? true,
  withTrash ? !stdenv.hostPlatform.isDarwin,
}:

rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "broot";
  version = "1.46.3";

  src = fetchFromGitHub {
    owner = "Canop";
    repo = "broot";
    rev = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-MfBlJ7SokBKkAkmBSj4NsE2hKVqYeGN3z/xiq2VK3vU=";
  };

@@ -29,7 +30,7 @@ rustPlatform.buildRustPackage rec {

  nativeBuildInputs = [
    installShellFiles
    makeWrapper
    makeBinaryWrapper
    pkg-config
  ];

@@ -43,13 +44,13 @@ rustPlatform.buildRustPackage rec {

  buildFeatures = lib.optionals withTrash [ "trash" ] ++ lib.optionals withClipboard [ "clipboard" ];

  RUSTONIG_SYSTEM_LIBONIG = true;
  env.RUSTONIG_SYSTEM_LIBONIG = true;

  postPatch = ''
    # Fill the version stub in the man page. We can't fill the date
    # stub reproducibly.
    substitute man/page man/broot.1 \
      --replace "#version" "${version}"
      --replace-fail "#version" "${finalAttrs.version}"
  '';

  postInstall =
@@ -84,16 +85,15 @@ rustPlatform.buildRustPackage rec {
    '';

  doInstallCheck = true;
  installCheckPhase = ''
    $out/bin/broot --version | grep "${version}"
  '';
  nativeInstallCheckInputs = [ versionCheckHook ];
  versionCheckProgramArg = "--version";

  meta = with lib; {
    description = "Interactive tree view, a fuzzy search, a balanced BFS descent and customizable commands";
    homepage = "https://dystroy.org/broot/";
    changelog = "https://github.com/Canop/broot/releases/tag/v${version}";
    changelog = "https://github.com/Canop/broot/releases/tag/v${finalAttrs.version}";
    maintainers = with maintainers; [ dywedir ];
    license = with licenses; [ mit ];
    mainProgram = "broot";
  };
}
})
+18 −16
Original line number Diff line number Diff line
@@ -3,16 +3,18 @@
  buildGoModule,
  fetchFromGitHub,
  installShellFiles,
  versionCheckHook,
  writableTmpDirAsHomeHook,
}:

buildGoModule rec {
buildGoModule (finalAttrs: {
  pname = "conftest";
  version = "0.59.0";

  src = fetchFromGitHub {
    owner = "open-policy-agent";
    repo = "conftest";
    tag = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-bmZp1cPNTm6m30YxjlWdnfv2437nDXH+taDNFZ0OKIY=";
  };
  vendorHash = "sha256-aPvGbtAucb9OdcydO4dMLJrrM3XretPI7zyJULlm1fg=";
@@ -20,17 +22,13 @@ buildGoModule rec {
  ldflags = [
    "-s"
    "-w"
    "-X github.com/open-policy-agent/conftest/internal/commands.version=${version}"
    "-X github.com/open-policy-agent/conftest/internal/commands.version=${finalAttrs.version}"
  ];

  nativeBuildInputs = [
    installShellFiles
  ];

  preCheck = ''
    export HOME="$(mktemp -d)"
  '';

  postInstall = ''
    installShellCompletion --cmd conftest \
      --bash <($out/bin/conftest completion bash) \
@@ -38,19 +36,23 @@ buildGoModule rec {
      --zsh <($out/bin/conftest completion zsh)
  '';

  nativeCheckInputs = [
    writableTmpDirAsHomeHook
  ];

  doInstallCheck = true;
  installCheckPhase = ''
    export HOME="$(mktemp -d)"
    $out/bin/conftest --version | grep ${version} > /dev/null
  '';
  nativeInstallCheckInputs = [
    versionCheckHook
  ];
  versionCheckProgramArg = "--version";

  meta = with lib; {
  meta = {
    description = "Write tests against structured configuration data";
    mainProgram = "conftest";
    downloadPage = "https://github.com/open-policy-agent/conftest";
    homepage = "https://www.conftest.dev";
    changelog = "https://github.com/open-policy-agent/conftest/releases/tag/v${version}";
    license = licenses.asl20;
    changelog = "https://github.com/open-policy-agent/conftest/releases/tag/v${finalAttrs.version}";
    license = lib.licenses.asl20;
    longDescription = ''
      Conftest helps you write tests against structured configuration data.
      Using Conftest you can write tests for your Kubernetes configuration,
@@ -61,9 +63,9 @@ buildGoModule rec {
      assertions. You can read more about Rego in 'How do I write policies' in
      the Open Policy Agent documentation.
    '';
    maintainers = with maintainers; [
    maintainers = with lib.maintainers; [
      jk
      yurrriq
    ];
  };
}
})
+11 −11
Original line number Diff line number Diff line
@@ -3,21 +3,22 @@
  buildGoModule,
  fetchFromGitHub,
  nixosTests,
  versionCheckHook,
}:

buildGoModule rec {
buildGoModule (finalAttrs: {
  pname = "ferretdb";
  version = "1.24.0";

  src = fetchFromGitHub {
    owner = "FerretDB";
    repo = "FerretDB";
    rev = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-WMejspnk2PvJhvNGi4h+DF+fzipuOMcS1QWim5DnAhQ=";
  };

  postPatch = ''
    echo v${version} > build/version/version.txt
    echo v${finalAttrs.version} > build/version/version.txt
    echo nixpkgs     > build/version/package.txt
  '';

@@ -32,22 +33,21 @@ buildGoModule rec {

  # the binary panics if something required wasn't set during compilation
  doInstallCheck = true;
  installCheckPhase = ''
    $out/bin/ferretdb --version | grep ${version}
  '';
  nativeInstallCheckInputs = [ versionCheckHook ];
  versionCheckProgramArg = "--version";

  passthru.tests = nixosTests.ferretdb;

  meta = with lib; {
  meta = {
    description = "Truly Open Source MongoDB alternative";
    mainProgram = "ferretdb";
    changelog = "https://github.com/FerretDB/FerretDB/releases/tag/v${version}";
    changelog = "https://github.com/FerretDB/FerretDB/releases/tag/v${finalAttrs.version}";
    homepage = "https://www.ferretdb.com/";
    license = licenses.asl20;
    maintainers = with maintainers; [
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [
      dit7ya
      noisersup
      julienmalka
    ];
  };
}
})
+13 −13
Original line number Diff line number Diff line
@@ -3,16 +3,17 @@
  buildGoModule,
  fetchFromGitHub,
  installShellFiles,
  versionCheckHook,
}:

buildGoModule rec {
buildGoModule (finalAttrs: {
  pname = "metal-cli";
  version = "0.25.0";

  src = fetchFromGitHub {
    owner = "equinix";
    repo = pname;
    rev = "v${version}";
    repo = "metal-cli";
    tag = "v${finalAttrs.version}";
    hash = "sha256-+hpsGFZHuVhh+fKVcap0vhoUmRs3xPgUwW8SD56m6uI=";
  };

@@ -21,7 +22,7 @@ buildGoModule rec {
  ldflags = [
    "-s"
    "-w"
    "-X github.com/equinix/metal-cli/cmd.Version=${version}"
    "-X github.com/equinix/metal-cli/cmd.Version=${finalAttrs.version}"
  ];

  nativeBuildInputs = [
@@ -38,21 +39,20 @@ buildGoModule rec {
  doCheck = false;

  doInstallCheck = true;
  nativeInstallCheckInputs = [ versionCheckHook ];
  versionCheckProgram = "${placeholder "out"}/bin/metal";
  versionCheckProgramArg = "--version";

  installCheckPhase = ''
    $out/bin/metal --version | grep ${version}
  '';

  meta = with lib; {
  meta = {
    description = "Official Equinix Metal CLI";
    homepage = "https://github.com/equinix/metal-cli/";
    changelog = "https://github.com/equinix/metal-cli/releases/tag/v${version}";
    license = licenses.mit;
    maintainers = with maintainers; [
    changelog = "https://github.com/equinix/metal-cli/releases/tag/v${finalAttrs.version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      Br1ght0ne
      nshalman
      teutat3s
    ];
    mainProgram = "metal";
  };
}
})
Loading