ferretdb: use versionCheckHook, modernise, cleanup

This commit is contained in:
Pol Dellaiera 2025-05-03 22:45:04 +02:00
parent e547f4f252
commit 1cb9626f62

View File

@ -3,21 +3,22 @@
buildGoModule, buildGoModule,
fetchFromGitHub, fetchFromGitHub,
nixosTests, nixosTests,
versionCheckHook,
}: }:
buildGoModule rec { buildGoModule (finalAttrs: {
pname = "ferretdb"; pname = "ferretdb";
version = "1.24.0"; version = "1.24.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "FerretDB"; owner = "FerretDB";
repo = "FerretDB"; repo = "FerretDB";
rev = "v${version}"; tag = "v${finalAttrs.version}";
hash = "sha256-WMejspnk2PvJhvNGi4h+DF+fzipuOMcS1QWim5DnAhQ="; hash = "sha256-WMejspnk2PvJhvNGi4h+DF+fzipuOMcS1QWim5DnAhQ=";
}; };
postPatch = '' postPatch = ''
echo v${version} > build/version/version.txt echo v${finalAttrs.version} > build/version/version.txt
echo nixpkgs > build/version/package.txt echo nixpkgs > build/version/package.txt
''; '';
@ -32,22 +33,21 @@ buildGoModule rec {
# the binary panics if something required wasn't set during compilation # the binary panics if something required wasn't set during compilation
doInstallCheck = true; doInstallCheck = true;
installCheckPhase = '' nativeInstallCheckInputs = [ versionCheckHook ];
$out/bin/ferretdb --version | grep ${version} versionCheckProgramArg = "--version";
'';
passthru.tests = nixosTests.ferretdb; passthru.tests = nixosTests.ferretdb;
meta = with lib; { meta = {
description = "Truly Open Source MongoDB alternative"; description = "Truly Open Source MongoDB alternative";
mainProgram = "ferretdb"; 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/"; homepage = "https://www.ferretdb.com/";
license = licenses.asl20; license = lib.licenses.asl20;
maintainers = with maintainers; [ maintainers = with lib.maintainers; [
dit7ya dit7ya
noisersup noisersup
julienmalka julienmalka
]; ];
}; };
} })