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,
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
];
};
}
})