regclient: Remove usage of rec and with (#453248)

This commit is contained in:
Sandro
2026-05-26 18:44:33 +00:00
committed by GitHub
+28 -21
View File
@@ -1,4 +1,5 @@
{
stdenv,
lib,
buildGoModule,
fetchFromGitHub,
@@ -16,15 +17,14 @@ let
];
in
buildGoModule rec {
buildGoModule (finalAttrs: {
pname = "regclient";
version = "0.11.3";
tag = "v${version}";
src = fetchFromGitHub {
owner = "regclient";
repo = "regclient";
rev = tag;
tag = "v${finalAttrs.version}";
sha256 = "sha256-/gKvjyFOzyTsgMuqCqZaWl2yun7f+eboQ0iLuXHh4lI=";
};
vendorHash = "sha256-P9ayAWvQY4WgmFTWzk2ZLQ5uwMvIsSfL73C99ROmze8=";
@@ -34,30 +34,37 @@ buildGoModule rec {
ldflags = [
"-s"
"-w"
"-X github.com/regclient/regclient/internal/version.vcsTag=${tag}"
"-X github.com/regclient/regclient/internal/version.vcsTag=${finalAttrs.src.tag}"
];
env.CGO_ENABLED = 0;
nativeBuildInputs = [
installShellFiles
lndir
];
postInstall = lib.concatMapStringsSep "\n" (bin: ''
export bin=''$${bin}
export outputBin=bin
postInstall = lib.concatMapStringsSep "\n" (
bin:
''
export bin=''$${bin}
export outputBin=bin
mkdir -p $bin/bin
mv $out/bin/${bin} $bin/bin
mkdir -p $bin/bin
mv $out/bin/${bin} $bin/bin
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd ${bin} \
--bash <($bin/bin/${bin} completion bash) \
--fish <($bin/bin/${bin} completion fish) \
--zsh <($bin/bin/${bin} completion zsh)
''
+ ''
lndir -silent $bin $out
installShellCompletion --cmd ${bin} \
--bash <($bin/bin/${bin} completion bash) \
--fish <($bin/bin/${bin} completion fish) \
--zsh <($bin/bin/${bin} completion zsh)
lndir -silent $bin $out
unset bin outputBin
'') bins;
unset bin outputBin
''
) bins;
checkFlags = [
# touches network
@@ -69,7 +76,7 @@ buildGoModule rec {
"${bin}Version" = testers.testVersion {
package = regclient;
command = "${bin} version";
version = tag;
version = finalAttrs.src.tag;
};
}) bins
);
@@ -80,6 +87,6 @@ buildGoModule rec {
description = "Docker and OCI Registry Client in Go and tooling using those libraries";
homepage = "https://github.com/regclient/regclient";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ maxbrunet ];
maintainers = [ lib.maintainers.maxbrunet ];
};
}
})