3
0
Fork 0
forked from mirrors/nixpkgs

nerdctl: 0.7.0 -> 0.7.1

Extract bash completion
Move to using --version now it doesn't exit on containerd socket missing
This commit is contained in:
06kellyjac 2021-03-11 15:29:18 +00:00
parent 354a880a3e
commit 9a4843c6e3

View file

@ -2,6 +2,7 @@
, buildGoModule , buildGoModule
, fetchFromGitHub , fetchFromGitHub
, makeWrapper , makeWrapper
, installShellFiles
, buildkit , buildkit
, cni-plugins , cni-plugins
, extraPackages ? [ ] , extraPackages ? [ ]
@ -9,23 +10,20 @@
buildGoModule rec { buildGoModule rec {
pname = "nerdctl"; pname = "nerdctl";
version = "0.7.0"; version = "0.7.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "AkihiroSuda"; owner = "AkihiroSuda";
repo = pname; repo = pname;
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-z5Ekryaa5KMShrjdsmFk9bXahtuc+6tec7dxH5/w7+A="; sha256 = "sha256-tMzob+ljGBKkfbxwMqy+8bqVp51Eqyx4kXhsj/LRfzQ=";
}; };
vendorSha256 = "sha256-ovmVNtzTQbg141IvbaF/+k5WHxX8wuK7z5gH9l2g5UE="; vendorSha256 = "sha256-zUX/kneVz8uXmxly8yqmcttK3Wj4EmBaT8gmg3hDms4=";
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper installShellFiles ];
preBuild = preBuild = let t = "github.com/AkihiroSuda/nerdctl/pkg/version"; in
let
t = "github.com/AkihiroSuda/nerdctl/pkg/version";
in
'' ''
buildFlagsArray+=("-ldflags" "-s -w -X ${t}.Version=v${version} -X ${t}.Revision=<unknown>") buildFlagsArray+=("-ldflags" "-s -w -X ${t}.Version=v${version} -X ${t}.Revision=<unknown>")
''; '';
@ -37,17 +35,19 @@ buildGoModule rec {
wrapProgram $out/bin/nerdctl \ wrapProgram $out/bin/nerdctl \
--prefix PATH : "${lib.makeBinPath ([ buildkit ] ++ extraPackages)}" \ --prefix PATH : "${lib.makeBinPath ([ buildkit ] ++ extraPackages)}" \
--prefix CNI_PATH : "${cni-plugins}/bin" --prefix CNI_PATH : "${cni-plugins}/bin"
# nerdctl panics without XDG_RUNTIME_DIR set
export XDG_RUNTIME_DIR=$TMPDIR
installShellCompletion --cmd nerdctl \
--bash <($out/bin/nerdctl completion bash)
''; '';
doInstallCheck = true; doInstallCheck = true;
installCheckPhase = '' installCheckPhase = ''
runHook preInstallCheck runHook preInstallCheck
# nerdctl expects XDG_RUNTIME_DIR to be set
export XDG_RUNTIME_DIR=$TMPDIR
$out/bin/nerdctl --help $out/bin/nerdctl --help
# --version will error without containerd.sock access $out/bin/nerdctl --version | grep "nerdctl version ${version}"
$out/bin/nerdctl --help | grep "${version}"
runHook postInstallCheck runHook postInstallCheck
''; '';