regclient: add shell completions and fix version output
This commit is contained in:
parent
dd5b898b7e
commit
ef0ed76841
|
@ -1,4 +1,12 @@
|
||||||
{ stdenv, lib, buildGoModule, fetchFromGitHub }:
|
{ stdenv
|
||||||
|
, lib
|
||||||
|
, buildGoModule
|
||||||
|
, fetchFromGitHub
|
||||||
|
, installShellFiles
|
||||||
|
, lndir
|
||||||
|
, testers
|
||||||
|
, regclient
|
||||||
|
}:
|
||||||
|
|
||||||
let bins = [ "regbot" "regctl" "regsync" ]; in
|
let bins = [ "regbot" "regctl" "regsync" ]; in
|
||||||
|
|
||||||
|
@ -20,22 +28,48 @@ buildGoModule rec {
|
||||||
ldflags = [
|
ldflags = [
|
||||||
"-s"
|
"-s"
|
||||||
"-w"
|
"-w"
|
||||||
"-X main.VCSTag=${tag}"
|
"-X github.com/regclient/regclient/internal/version.vcsTag=${tag}"
|
||||||
];
|
];
|
||||||
|
|
||||||
postInstall =
|
nativeBuildInputs = [ installShellFiles lndir ];
|
||||||
lib.concatStringsSep "\n" (
|
|
||||||
map (bin: ''
|
postInstall = lib.concatMapStringsSep "\n"
|
||||||
mkdir -p ''$${bin}/bin &&
|
(bin: ''
|
||||||
mv $out/bin/${bin} ''$${bin}/bin/ &&
|
export bin=''$${bin}
|
||||||
ln -s ''$${bin}/bin/${bin} $out/bin/
|
export outputBin=bin
|
||||||
'') bins
|
|
||||||
);
|
mkdir -p $bin/bin
|
||||||
|
mv $out/bin/${bin} $bin/bin
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
passthru.tests = lib.mergeAttrsList (
|
||||||
|
map
|
||||||
|
(bin: {
|
||||||
|
"${bin}Version" = testers.testVersion {
|
||||||
|
package = regclient;
|
||||||
|
command = "${bin} version";
|
||||||
|
version = tag;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
bins
|
||||||
|
);
|
||||||
|
|
||||||
|
__darwinAllowLocalNetworking = true;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Docker and OCI Registry Client in Go and tooling using those libraries";
|
description = "Docker and OCI Registry Client in Go and tooling using those libraries";
|
||||||
homepage = "https://github.com/regclient/regclient";
|
homepage = "https://github.com/regclient/regclient";
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
maintainers = with maintainers; [ ];
|
maintainers = with maintainers; [ maxbrunet ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user