keep-sorted: use finalAttrs

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
This commit is contained in:
Paul Meyer 2025-04-11 12:59:18 +02:00
parent 2d23979ef5
commit cfe0dd5b45

View file

@ -6,14 +6,14 @@
versionCheckHook, versionCheckHook,
}: }:
buildGoModule rec { buildGoModule (finalAttrs: {
pname = "keep-sorted"; pname = "keep-sorted";
version = "0.6.1"; version = "0.6.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "google"; owner = "google";
repo = "keep-sorted"; repo = "keep-sorted";
tag = "v${version}"; tag = "v${finalAttrs.version}";
hash = "sha256-N/fJ0qj7/kQ9Q7ULpQpyhWAWFlnLkTjyNNKg8VhLvi0="; hash = "sha256-N/fJ0qj7/kQ9Q7ULpQpyhWAWFlnLkTjyNNKg8VhLvi0=";
}; };
@ -22,7 +22,7 @@ buildGoModule rec {
# Inject version string instead of reading version from buildinfo. # Inject version string instead of reading version from buildinfo.
postPatch = '' postPatch = ''
substituteInPlace main.go \ substituteInPlace main.go \
--replace-fail 'readVersion())' '"v${version}")' --replace-fail 'readVersion())' '"v${finalAttrs.version}")'
''; '';
env.CGO_ENABLED = "0"; env.CGO_ENABLED = "0";
@ -41,11 +41,11 @@ buildGoModule rec {
passthru.updateScript = nix-update-script { }; passthru.updateScript = nix-update-script { };
meta = { meta = {
changelog = "https://github.com/google/keep-sorted/releases/tag/v${version}"; changelog = "https://github.com/google/keep-sorted/releases/tag/v${finalAttrs.version}";
description = "Language-agnostic formatter that sorts lines between two markers in a larger file"; description = "Language-agnostic formatter that sorts lines between two markers in a larger file";
homepage = "https://github.com/google/keep-sorted"; homepage = "https://github.com/google/keep-sorted";
license = lib.licenses.asl20; license = lib.licenses.asl20;
mainProgram = "keep-sorted"; mainProgram = "keep-sorted";
maintainers = with lib.maintainers; [ katexochen ]; maintainers = with lib.maintainers; [ katexochen ];
}; };
} })