From 05967b72133c2cf2877588cd7085e75868efb43a Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 18 Apr 2025 00:58:21 +0200 Subject: [PATCH] rq: cleanup --- pkgs/by-name/rq/rq/package.nix | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/pkgs/by-name/rq/rq/package.nix b/pkgs/by-name/rq/rq/package.nix index c6245e9c1d42..af243166d8ef 100644 --- a/pkgs/by-name/rq/rq/package.nix +++ b/pkgs/by-name/rq/rq/package.nix @@ -2,17 +2,19 @@ lib, rustPlatform, fetchFromGitHub, + versionCheckHook, + nix-update-script, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "rq"; version = "1.0.4"; src = fetchFromGitHub { owner = "dflemstr"; - repo = pname; - rev = "v${version}"; - sha256 = "sha256-QyYTbMXikLSe3eYJRUALQJxUJjA6VlvaLMwGrxIKfZI="; + repo = "rq"; + tag = "v${finalAttrs.version}"; + hash = "sha256-QyYTbMXikLSe3eYJRUALQJxUJjA6VlvaLMwGrxIKfZI="; }; useFetchCargoVendor = true; @@ -22,24 +24,34 @@ rustPlatform.buildRustPackage rec { # Remove #[deny(warnings)] which is equivalent to -Werror in C. # Prevents build failures when upgrading rustc, which may give more warnings. substituteInPlace src/lib.rs \ - --replace "#![deny(warnings)]" "" + --replace-fail "#![deny(warnings)]" "" # build script tries to get version information from git # this fixes the --version output rm build.rs ''; - VERGEN_SEMVER = version; + VERGEN_SEMVER = finalAttrs.version; - meta = with lib; { + nativeInstallCheckInputs = [ + versionCheckHook + ]; + versionCheckProgramArg = "--version"; + doInstallCheck = true; + + passthru = { + updateScript = nix-update-script { }; + }; + + meta = { description = "Tool for doing record analysis and transformation"; mainProgram = "rq"; homepage = "https://github.com/dflemstr/rq"; - license = with licenses; [ asl20 ]; - maintainers = with maintainers; [ + license = with lib.licenses; [ asl20 ]; + maintainers = with lib.maintainers; [ aristid Br1ght0ne figsoda ]; }; -} +})