diff --git a/pkgs/by-name/at/atlantis/package.nix b/pkgs/by-name/at/atlantis/package.nix index a6872325b99d..57b74162f0b3 100644 --- a/pkgs/by-name/at/atlantis/package.nix +++ b/pkgs/by-name/at/atlantis/package.nix @@ -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 ]; }; -} +}) diff --git a/pkgs/by-name/br/broot/package.nix b/pkgs/by-name/br/broot/package.nix index 4a17c10874ff..0d458da4f6b9 100644 --- a/pkgs/by-name/br/broot/package.nix +++ b/pkgs/by-name/br/broot/package.nix @@ -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"; }; -} +}) diff --git a/pkgs/by-name/co/conftest/package.nix b/pkgs/by-name/co/conftest/package.nix index 409fd6999a5d..6878520d44c6 100644 --- a/pkgs/by-name/co/conftest/package.nix +++ b/pkgs/by-name/co/conftest/package.nix @@ -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) ''; - doInstallCheck = true; - installCheckPhase = '' - export HOME="$(mktemp -d)" - $out/bin/conftest --version | grep ${version} > /dev/null - ''; + nativeCheckInputs = [ + writableTmpDirAsHomeHook + ]; - meta = with lib; { + doInstallCheck = true; + nativeInstallCheckInputs = [ + versionCheckHook + ]; + versionCheckProgramArg = "--version"; + + 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 ]; }; -} +}) diff --git a/pkgs/by-name/fe/ferretdb/package.nix b/pkgs/by-name/fe/ferretdb/package.nix index 438365de4091..6dbd19811140 100644 --- a/pkgs/by-name/fe/ferretdb/package.nix +++ b/pkgs/by-name/fe/ferretdb/package.nix @@ -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 ]; }; -} +}) diff --git a/pkgs/by-name/me/metal-cli/package.nix b/pkgs/by-name/me/metal-cli/package.nix index b13d6bb0d162..3f1e570e567d 100644 --- a/pkgs/by-name/me/metal-cli/package.nix +++ b/pkgs/by-name/me/metal-cli/package.nix @@ -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"; }; -} +}) diff --git a/pkgs/by-name/or/oras/package.nix b/pkgs/by-name/or/oras/package.nix index da05223e2f2f..b8ae0063f634 100644 --- a/pkgs/by-name/or/oras/package.nix +++ b/pkgs/by-name/or/oras/package.nix @@ -5,16 +5,17 @@ installShellFiles, testers, oras, + versionCheckHook, }: -buildGoModule rec { +buildGoModule (finalAttrs: { pname = "oras"; version = "1.2.3"; src = fetchFromGitHub { owner = "oras-project"; repo = "oras"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-IXIw2prApg5iL3BPbOY4x09KjyhFvKofgfz2L6UXKR8="; }; @@ -27,7 +28,7 @@ buildGoModule rec { ldflags = [ "-s" "-w" - "-X oras.land/oras/internal/version.Version=${version}" + "-X oras.land/oras/internal/version.Version=${finalAttrs.version}" "-X oras.land/oras/internal/version.BuildMetadata=" "-X oras.land/oras/internal/version.GitTreeState=clean" ]; @@ -40,29 +41,18 @@ buildGoModule rec { ''; doInstallCheck = true; - installCheckPhase = '' - runHook preInstallCheck + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "version"; - $out/bin/oras --help - $out/bin/oras version | grep "${version}" - - runHook postInstallCheck - ''; - - passthru.tests.version = testers.testVersion { - package = oras; - command = "oras version"; - }; - - meta = with lib; { + meta = { homepage = "https://oras.land/"; - changelog = "https://github.com/oras-project/oras/releases/tag/v${version}"; + changelog = "https://github.com/oras-project/oras/releases/tag/v${finalAttrs.version}"; description = "ORAS project provides a way to push and pull OCI Artifacts to and from OCI Registries"; mainProgram = "oras"; - license = licenses.asl20; - maintainers = with maintainers; [ + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ jk developer-guy ]; }; -} +})