ferretdb: use `versionCheckHook`, modernise, cleanup

+11 -11
+11 -11
pkgs/by-name/fe/ferretdb/package.nix
··· 3 buildGoModule, 4 fetchFromGitHub, 5 nixosTests, 6 }: 7 8 - buildGoModule rec { 9 pname = "ferretdb"; 10 version = "1.24.0"; 11 12 src = fetchFromGitHub { 13 owner = "FerretDB"; 14 repo = "FerretDB"; 15 - rev = "v${version}"; 16 hash = "sha256-WMejspnk2PvJhvNGi4h+DF+fzipuOMcS1QWim5DnAhQ="; 17 }; 18 19 postPatch = '' 20 - echo v${version} > build/version/version.txt 21 echo nixpkgs > build/version/package.txt 22 ''; 23 ··· 32 33 # the binary panics if something required wasn't set during compilation 34 doInstallCheck = true; 35 - installCheckPhase = '' 36 - $out/bin/ferretdb --version | grep ${version} 37 - ''; 38 39 passthru.tests = nixosTests.ferretdb; 40 41 - meta = with lib; { 42 description = "Truly Open Source MongoDB alternative"; 43 mainProgram = "ferretdb"; 44 - changelog = "https://github.com/FerretDB/FerretDB/releases/tag/v${version}"; 45 homepage = "https://www.ferretdb.com/"; 46 - license = licenses.asl20; 47 - maintainers = with maintainers; [ 48 dit7ya 49 noisersup 50 julienmalka 51 ]; 52 }; 53 - }
··· 3 buildGoModule, 4 fetchFromGitHub, 5 nixosTests, 6 + versionCheckHook, 7 }: 8 9 + buildGoModule (finalAttrs: { 10 pname = "ferretdb"; 11 version = "1.24.0"; 12 13 src = fetchFromGitHub { 14 owner = "FerretDB"; 15 repo = "FerretDB"; 16 + tag = "v${finalAttrs.version}"; 17 hash = "sha256-WMejspnk2PvJhvNGi4h+DF+fzipuOMcS1QWim5DnAhQ="; 18 }; 19 20 postPatch = '' 21 + echo v${finalAttrs.version} > build/version/version.txt 22 echo nixpkgs > build/version/package.txt 23 ''; 24 ··· 33 34 # the binary panics if something required wasn't set during compilation 35 doInstallCheck = true; 36 + nativeInstallCheckInputs = [ versionCheckHook ]; 37 + versionCheckProgramArg = "--version"; 38 39 passthru.tests = nixosTests.ferretdb; 40 41 + meta = { 42 description = "Truly Open Source MongoDB alternative"; 43 mainProgram = "ferretdb"; 44 + changelog = "https://github.com/FerretDB/FerretDB/releases/tag/v${finalAttrs.version}"; 45 homepage = "https://www.ferretdb.com/"; 46 + license = lib.licenses.asl20; 47 + maintainers = with lib.maintainers; [ 48 dit7ya 49 noisersup 50 julienmalka 51 ]; 52 }; 53 + })