containerd: misc fixes

- build man during buildPhase
- use `src.rev` for `commit`
- install completion
This commit is contained in:
zowoq 2020-12-03 07:23:47 +10:00
parent f37c665ea3
commit d7d6f5507c
1 changed files with 22 additions and 15 deletions

View File

@ -1,12 +1,16 @@
{ lib, fetchFromGitHub, buildGoPackage, btrfs-progs, go-md2man, installShellFiles, util-linux, nixosTests }:
with lib;
{ lib
, fetchFromGitHub
, buildGoPackage
, btrfs-progs
, go-md2man
, installShellFiles
, util-linux
, nixosTests
}:
buildGoPackage rec {
pname = "containerd";
version = "1.4.3";
# git commit for the above version's tag
commit = "269548fa27e0089a8b8278fc4fc781d7f65a939b";
src = fetchFromGitHub {
owner = "containerd";
@ -22,29 +26,32 @@ buildGoPackage rec {
buildInputs = [ btrfs-progs ];
buildFlags = [ "VERSION=v${version}" "REVISION=${commit}" ];
buildFlags = [ "VERSION=v${version}" "REVISION=${src.rev}" ];
BUILDTAGS = []
++ optional (btrfs-progs == null) "no_btrfs";
BUILDTAGS = [ ]
++ lib.optional (btrfs-progs == null) "no_btrfs";
buildPhase = ''
cd go/src/${goPackagePath}
patchShebangs .
make binaries $buildFlags
make binaries man $buildFlags
'';
installPhase = ''
for b in bin/*; do
install -Dm555 $b $out/$b
done
make man
install -Dm555 bin/* -t $out/bin
installManPage man/*.[1-9]
'';
# completion installed separately so it can be overridden in docker
# can be moved to installPhase when docker uses containerd >= 1.4
postInstall = ''
installShellFiles --bash contrib/autocomplete/ctr
installShellFiles --zsh --name _ctr contrib/autocomplete/zsh_autocomplete
'';
passthru.tests = { inherit (nixosTests) docker; };
meta = {
meta = with lib; {
homepage = "https://containerd.io/";
description = "A daemon to control runC";
license = licenses.asl20;