From 85238bccd05092b1e7f82acfd86068ba6df685eb Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Wed, 4 Jun 2025 09:02:03 -0700 Subject: [PATCH] cljstyle: refactor to finalAttrs style --- pkgs/by-name/cl/cljstyle/package.nix | 34 ++++++++++++---------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/pkgs/by-name/cl/cljstyle/package.nix b/pkgs/by-name/cl/cljstyle/package.nix index f27f1bd57957..9685a24151bd 100644 --- a/pkgs/by-name/cl/cljstyle/package.nix +++ b/pkgs/by-name/cl/cljstyle/package.nix @@ -3,50 +3,44 @@ buildGraalvmNativeImage, fetchMavenArtifact, fetchurl, - graalvmPackages, versionCheckHook, }: -let +buildGraalvmNativeImage (finalAttrs: { pname = "cljstyle"; version = "0.17.642"; - # must be on classpath to build native image - graal-build-time = fetchMavenArtifact { - repos = [ "https://repo.clojars.org/" ]; - groupId = "com.github.clj-easy"; - artifactId = "graal-build-time"; - version = "1.0.5"; - hash = "sha256-M6/U27a5n/QGuUzGmo8KphVnNa2K+LFajP5coZiFXoY="; - }; -in -buildGraalvmNativeImage { - inherit pname version; - src = fetchurl { - url = "https://github.com/greglook/${pname}/releases/download/${version}/${pname}-${version}.jar"; + url = "https://github.com/greglook/cljstyle/releases/download/${finalAttrs.version}/cljstyle-${finalAttrs.version}.jar"; hash = "sha256-AkCuTZeDXbNBuwPZEMhYGF/oOGIKq5zVDwL8xwnj+mE="; }; - graalvmDrv = graalvmPackages.graalvm-ce; - extraNativeImageBuildArgs = [ "-H:+ReportExceptionStackTraces" "--no-fallback" - "-cp ${graal-build-time.passthru.jar}" + "-cp ${finalAttrs.finalPackage.passthru.graal-build-time.passthru.jar}" ]; doInstallCheck = true; nativeInstallCheckInputs = [ versionCheckHook ]; versionCheckProgramArg = [ "version" ]; + # must be on classpath to build native image + passthru.graal-build-time = fetchMavenArtifact { + repos = [ "https://repo.clojars.org/" ]; + groupId = "com.github.clj-easy"; + artifactId = "graal-build-time"; + version = "1.0.5"; + hash = "sha256-M6/U27a5n/QGuUzGmo8KphVnNa2K+LFajP5coZiFXoY="; + }; + meta = { description = "Tool for formatting Clojure code"; homepage = "https://github.com/greglook/cljstyle"; sourceProvenance = with lib.sourceTypes; [ binaryBytecode ]; license = lib.licenses.epl10; - changelog = "https://github.com/greglook/cljstyle/blob/${version}/CHANGELOG.md"; + changelog = "https://github.com/greglook/cljstyle/blob/${finalAttrs.version}/CHANGELOG.md"; maintainers = with lib.maintainers; [ psyclyx ]; mainProgram = "cljstyle"; }; -} +})