From f8164fc556359ab915e84e9cbb09e086ff8a238b Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Wed, 4 Jun 2025 09:08:31 -0700 Subject: [PATCH] cq: refactor to finalAttrs style --- pkgs/by-name/cq/cq/package.nix | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/cq/cq/package.nix b/pkgs/by-name/cq/cq/package.nix index 406a874b8748..d0b44ed69dfd 100644 --- a/pkgs/by-name/cq/cq/package.nix +++ b/pkgs/by-name/cq/cq/package.nix @@ -6,42 +6,39 @@ graalvmPackages, }: -buildGraalvmNativeImage rec { +buildGraalvmNativeImage (finalAttrs: { pname = "cq"; version = "2024.06.24-12.10"; # we need both src (the prebuild jar) src = fetchurl { - url = "https://github.com/markus-wa/cq/releases/download/${version}/cq.jar"; + url = "https://github.com/markus-wa/cq/releases/download/${finalAttrs.version}/cq.jar"; hash = "sha256-iULV+j/AuGVYPYhbOTQTKd3n+VZhWQYBRE6cRiaa1/M="; }; # and build-src (for the native-image build process) - build-src = fetchFromGitHub { + passthru.build-src = fetchFromGitHub { owner = "markus-wa"; repo = "cq"; - rev = version; + tag = finalAttrs.version; hash = "sha256-yjAC2obipdmh+JlHzVUTMtTXN2VKe4WKkyJyu2Q93c8="; }; - graalvmDrv = graalvmPackages.graalvm-ce; - - executable = "cq"; - # copied verbatim from the upstream build script https://github.com/markus-wa/cq/blob/main/package/build-native.sh#L5 extraNativeImageBuildArgs = [ "--report-unsupported-elements-at-runtime" "--initialize-at-build-time" "--no-server" - "-H:ReflectionConfigurationFiles=${build-src}/package/reflection-config.json" + "-H:ReflectionConfigurationFiles=${finalAttrs.finalPackage.build-src}/package/reflection-config.json" ]; meta = { description = "Clojure Query: A Command-line Data Processor for JSON, YAML, EDN, XML and more"; homepage = "https://github.com/markus-wa/cq"; - changelog = "https://github.com/markus-wa/cq/releases/releases/tag/${version}"; + changelog = "https://github.com/markus-wa/cq/releases/releases/tag/${finalAttrs.version}"; license = lib.licenses.epl20; maintainers = with lib.maintainers; [ farcaller ]; platforms = lib.platforms.unix; + mainProgram = "cq"; }; -} +})