From d7d6f5507c9b3b551d7b02ac8d2021b66c5e176d Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Thu, 3 Dec 2020 07:23:47 +1000 Subject: [PATCH 1/2] containerd: misc fixes - build man during buildPhase - use `src.rev` for `commit` - install completion --- .../virtualization/containerd/default.nix | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/pkgs/applications/virtualization/containerd/default.nix b/pkgs/applications/virtualization/containerd/default.nix index cece3cc6b67..695109fd8a4 100644 --- a/pkgs/applications/virtualization/containerd/default.nix +++ b/pkgs/applications/virtualization/containerd/default.nix @@ -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; From 824cfdd019fd721a489cd6ffc6cc5992d658f9f2 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Thu, 3 Dec 2020 07:32:58 +1000 Subject: [PATCH 2/2] docker: disable containerd completion not available in containerd prior to 1.4 --- pkgs/applications/virtualization/docker/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/applications/virtualization/docker/default.nix b/pkgs/applications/virtualization/docker/default.nix index 1d55744efb4..1f4d5e3aac6 100644 --- a/pkgs/applications/virtualization/docker/default.nix +++ b/pkgs/applications/virtualization/docker/default.nix @@ -41,6 +41,8 @@ rec { rev = containerdRev; sha256 = containerdSha256; }; + # disable completion, can be removed when docker uses containerd >= 1.4 + postInstall = []; # This should be removed once Docker uses containerd >=1.4 nativeBuildInputs = oldAttrs.nativeBuildInputs ++ lib.optional withlibseccomp pkgconfig; buildInputs = oldAttrs.buildInputs ++ lib.optional withlibseccomp libseccomp;