Commit 21d9d56c authored by Pol Dellaiera's avatar Pol Dellaiera
Browse files

metal-cli: use `versionCheckHook`

parent f783f655
Loading
Loading
Loading
Loading
+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";
  };
}
})