fleeting-plugin-aws: Switch from rec to finalAttrs. Run tests.

This commit is contained in:
commiterate 2025-04-07 21:42:36 -04:00
parent 5babb318ba
commit 4ed7895482

View file

@ -6,44 +6,37 @@
versionCheckHook, versionCheckHook,
}: }:
buildGoModule rec { buildGoModule (finalAttrs: {
pname = "fleeting-plugin-aws"; pname = "fleeting-plugin-aws";
version = "1.0.1"; version = "1.0.1";
src = fetchFromGitLab { src = fetchFromGitLab {
owner = "gitlab-org/fleeting/plugins"; owner = "gitlab-org/fleeting/plugins";
repo = "aws"; repo = "aws";
tag = "v${version}"; tag = "v${finalAttrs.version}";
hash = "sha256-3m7t2uGO7Rlfckb8mdYVutW0/ng0OiUAH5XTBoB//ZU="; hash = "sha256-3m7t2uGO7Rlfckb8mdYVutW0/ng0OiUAH5XTBoB//ZU=";
}; };
vendorHash = "sha256-hfuszGVWfMreGz22+dkx0/cxznjq2XZf7pAn4TWOQ5M="; vendorHash = "sha256-hfuszGVWfMreGz22+dkx0/cxznjq2XZf7pAn4TWOQ5M=";
subPackages = [ "cmd/fleeting-plugin-aws" ]; # Needed for "fleeting-plugin-aws -version" to not show "dev".
# See https://gitlab.com/gitlab-org/fleeting/plugins/aws/-/blob/v1.0.0/Makefile?ref_type=tags#L20-22.
# #
# Needed for "fleeting-plugin-aws version" to not show "dev". # https://gitlab.com/gitlab-org/fleeting/plugins/aws/-/blob/v1.0.0/Makefile?ref_type=tags#L20-22
ldflags = ldflags =
let let
# See https://gitlab.com/gitlab-org/fleeting/plugins/aws/-/blob/v1.0.0/Makefile?ref_type=tags#L14.
#
# Couldn't find a way to substitute "go list ." into "ldflags".
ldflagsPackageVariablePrefix = "gitlab.com/gitlab-org/fleeting/plugins/aws"; ldflagsPackageVariablePrefix = "gitlab.com/gitlab-org/fleeting/plugins/aws";
in in
[ [
"-X ${ldflagsPackageVariablePrefix}.NAME=fleeting-plugin-aws" "-X ${ldflagsPackageVariablePrefix}.NAME=fleeting-plugin-aws"
"-X ${ldflagsPackageVariablePrefix}.VERSION=v${version}" "-X ${ldflagsPackageVariablePrefix}.VERSION=${finalAttrs.version}"
"-X ${ldflagsPackageVariablePrefix}.REVISION=${src.rev}" "-X ${ldflagsPackageVariablePrefix}.REFERENCE=v${finalAttrs.version}"
]; ];
doInstallCheck = true; doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ]; nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgram = "${builtins.placeholder "out"}/bin/fleeting-plugin-aws"; versionCheckProgramArg = "-version";
versionCheckProgramArg = "version";
passthru = { passthru = {
updateScript = nix-update-script { }; updateScript = nix-update-script { };
@ -56,4 +49,4 @@ buildGoModule rec {
mainProgram = "fleeting-plugin-aws"; mainProgram = "fleeting-plugin-aws";
maintainers = with lib.maintainers; [ commiterate ]; maintainers = with lib.maintainers; [ commiterate ];
}; };
} })