cue: use finalAttrs

This commit is contained in:
Aaron Jheng 2025-05-24 21:13:14 +08:00
parent f2256199df
commit 8d5b47e9b8
No known key found for this signature in database
GPG key ID: F6A547A869D050A3

View file

@ -5,18 +5,17 @@
stdenv, stdenv,
installShellFiles, installShellFiles,
testers, testers,
cue,
callPackage, callPackage,
}: }:
buildGoModule rec { buildGoModule (finalAttrs: {
pname = "cue"; pname = "cue";
version = "0.13.0"; version = "0.13.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "cue-lang"; owner = "cue-lang";
repo = "cue"; repo = "cue";
tag = "v${version}"; tag = "v${finalAttrs.version}";
hash = "sha256-RvdjZ3wSc3IhQvYJL989x33qOtVZ4paoQTLFzWF9xj0="; hash = "sha256-RvdjZ3wSc3IhQvYJL989x33qOtVZ4paoQTLFzWF9xj0=";
}; };
@ -29,7 +28,7 @@ buildGoModule rec {
ldflags = [ ldflags = [
"-s" "-s"
"-w" "-w"
"-X cuelang.org/go/cmd/cue/cmd.version=v${version}" "-X cuelang.org/go/cmd/cue/cmd.version=v${finalAttrs.version}"
]; ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
@ -44,9 +43,9 @@ buildGoModule rec {
tests = { tests = {
test-001-all-good = callPackage ./tests/001-all-good.nix { }; test-001-all-good = callPackage ./tests/001-all-good.nix { };
version = testers.testVersion { version = testers.testVersion {
package = cue; package = finalAttrs.finalPackage;
command = "cue version"; command = "cue version";
version = "v${version}"; version = "v${finalAttrs.version}";
}; };
}; };
}; };
@ -58,4 +57,4 @@ buildGoModule rec {
maintainers = with lib.maintainers; [ aaronjheng ]; maintainers = with lib.maintainers; [ aaronjheng ];
mainProgram = "cue"; mainProgram = "cue";
}; };
} })