Merge pull request #202437 from SuperSandro2000/docker
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
{ lib, callPackage, fetchFromGitHub }:
|
||||
|
||||
with lib;
|
||||
|
||||
rec {
|
||||
dockerGen = {
|
||||
version, rev, sha256
|
||||
@@ -13,11 +11,14 @@ rec {
|
||||
, stdenv, fetchFromGitHub, fetchpatch, buildGoPackage
|
||||
, makeWrapper, installShellFiles, pkg-config, glibc
|
||||
, go-md2man, go, containerd, runc, docker-proxy, tini, libtool
|
||||
, sqlite, iproute2, lvm2, systemd, docker-buildx, docker-compose
|
||||
, btrfs-progs, iptables, e2fsprogs, xz, util-linux, xfsprogs, git
|
||||
, procps, libseccomp, rootlesskit, slirp4netns, fuse-overlayfs
|
||||
, nixosTests
|
||||
, sqlite, iproute2, docker-buildx, docker-compose
|
||||
, iptables, e2fsprogs, xz, util-linux, xfsprogs, git
|
||||
, procps, rootlesskit, slirp4netns, fuse-overlayfs, nixosTests
|
||||
, clientOnly ? !stdenv.isLinux, symlinkJoin
|
||||
, withSystemd ? true, systemd
|
||||
, withBtrfs ? true, btrfs-progs
|
||||
, withLvm ? true, lvm2
|
||||
, withSeccomp ? true, libseccomp
|
||||
}:
|
||||
let
|
||||
docker-runc = runc.overrideAttrs (oldAttrs: {
|
||||
@@ -46,7 +47,8 @@ rec {
|
||||
sha256 = containerdSha256;
|
||||
};
|
||||
|
||||
buildInputs = oldAttrs.buildInputs ++ [ libseccomp ];
|
||||
buildInputs = oldAttrs.buildInputs
|
||||
++ lib.optional withSeccomp [ libseccomp ];
|
||||
});
|
||||
|
||||
docker-tini = tini.overrideAttrs (oldAttrs: {
|
||||
@@ -68,7 +70,7 @@ rec {
|
||||
NIX_CFLAGS_COMPILE = "-DMINIMAL=ON";
|
||||
});
|
||||
|
||||
moby = buildGoPackage (optionalAttrs stdenv.isLinux rec {
|
||||
moby = buildGoPackage (lib.optionalAttrs stdenv.isLinux rec {
|
||||
pname = "moby";
|
||||
inherit version;
|
||||
|
||||
@@ -77,11 +79,15 @@ rec {
|
||||
goPackagePath = "github.com/docker/docker";
|
||||
|
||||
nativeBuildInputs = [ makeWrapper pkg-config go-md2man go libtool installShellFiles ];
|
||||
buildInputs = [ sqlite lvm2 btrfs-progs systemd libseccomp ];
|
||||
buildInputs = [ sqlite ]
|
||||
++ lib.optional withLvm lvm2
|
||||
++ lib.optional withBtrfs btrfs-progs
|
||||
++ lib.optional withSystemd systemd
|
||||
++ lib.optional withSeccomp libseccomp;
|
||||
|
||||
extraPath = optionals stdenv.isLinux (makeBinPath [ iproute2 iptables e2fsprogs xz xfsprogs procps util-linux git ]);
|
||||
extraPath = lib.optionals stdenv.isLinux (lib.makeBinPath [ iproute2 iptables e2fsprogs xz xfsprogs procps util-linux git ]);
|
||||
|
||||
extraUserPath = optionals (stdenv.isLinux && !clientOnly) (makeBinPath [ rootlesskit slirp4netns fuse-overlayfs ]);
|
||||
extraUserPath = lib.optionals (stdenv.isLinux && !clientOnly) (lib.makeBinPath [ rootlesskit slirp4netns fuse-overlayfs ]);
|
||||
|
||||
patches = [
|
||||
# This patch incorporates code from a PR fixing using buildkit with the ZFS graph driver.
|
||||
@@ -132,15 +138,21 @@ rec {
|
||||
--prefix PATH : "$out/libexec/docker:$extraPath:$extraUserPath"
|
||||
'';
|
||||
|
||||
DOCKER_BUILDTAGS = [ "journald" "seccomp" ];
|
||||
DOCKER_BUILDTAGS = lib.optional withSystemd "journald"
|
||||
++ lib.optional withBtrfs "exclude_graphdriver_btrfs"
|
||||
++ lib.optional withLvm "exclude_graphdriver_devicemapper"
|
||||
++ lib.optional withSeccomp "seccomp";
|
||||
});
|
||||
|
||||
plugins = optionals buildxSupport [ docker-buildx ]
|
||||
++ optionals composeSupport [ docker-compose ];
|
||||
plugins = lib.optional buildxSupport docker-buildx
|
||||
++ lib.optional composeSupport docker-compose;
|
||||
pluginsRef = symlinkJoin { name = "docker-plugins"; paths = plugins; };
|
||||
in
|
||||
buildGoPackage (optionalAttrs (!clientOnly) {
|
||||
} // rec {
|
||||
buildGoPackage (lib.optionalAttrs (!clientOnly) {
|
||||
# allow overrides of docker components
|
||||
# TODO: move packages out of the let...in into top-level to allow proper overrides
|
||||
inherit docker-runc docker-containerd docker-proxy docker-tini moby;
|
||||
} // rec {
|
||||
pname = "docker";
|
||||
inherit version;
|
||||
|
||||
@@ -156,14 +168,17 @@ rec {
|
||||
nativeBuildInputs = [
|
||||
makeWrapper pkg-config go-md2man go libtool installShellFiles
|
||||
];
|
||||
buildInputs = optionals (!clientOnly) [
|
||||
sqlite lvm2 btrfs-progs systemd libseccomp
|
||||
] ++ plugins;
|
||||
buildInputs = lib.optional (!clientOnly) sqlite
|
||||
++ lib.optional withLvm lvm2
|
||||
++ lib.optional withBtrfs btrfs-progs
|
||||
++ lib.optional withSystemd systemd
|
||||
++ lib.optional withSeccomp libseccomp
|
||||
++ plugins;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs man scripts/build/
|
||||
substituteInPlace ./scripts/build/.variables --replace "set -eu" ""
|
||||
'' + optionalString (plugins != []) ''
|
||||
'' + lib.optionalString (plugins != []) ''
|
||||
substituteInPlace ./cli-plugins/manager/manager_unix.go --replace /usr/libexec/docker/cli-plugins \
|
||||
"${pluginsRef}/libexec/docker/cli-plugins"
|
||||
'';
|
||||
@@ -194,7 +209,7 @@ rec {
|
||||
|
||||
makeWrapper $out/libexec/docker/docker $out/bin/docker \
|
||||
--prefix PATH : "$out/libexec/docker:$extraPath"
|
||||
'' + optionalString (!clientOnly) ''
|
||||
'' + lib.optionalString (!clientOnly) ''
|
||||
# symlink docker daemon to docker cli derivation
|
||||
ln -s ${moby}/bin/dockerd $out/bin/dockerd
|
||||
ln -s ${moby}/bin/dockerd-rootless $out/bin/dockerd-rootless
|
||||
@@ -222,17 +237,18 @@ rec {
|
||||
installManPage man/*/*.[1-9]
|
||||
'';
|
||||
|
||||
passthru.tests = lib.optionals (!clientOnly) { inherit (nixosTests) docker; };
|
||||
passthru = {
|
||||
# Exposed for tarsum build on non-linux systems (build-support/docker/default.nix)
|
||||
inherit moby-src;
|
||||
tests = lib.optionals (!clientOnly) { inherit (nixosTests) docker; };
|
||||
};
|
||||
|
||||
meta = {
|
||||
meta = with lib; {
|
||||
homepage = "https://www.docker.com/";
|
||||
description = "An open source project to pack, ship and run any application as a lightweight container";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ offline tailhook vdemeester periklis mikroskeem maxeaubrey ];
|
||||
};
|
||||
|
||||
# Exposed for tarsum build on non-linux systems (build-support/docker/default.nix)
|
||||
inherit moby-src;
|
||||
});
|
||||
|
||||
# Get revisions from
|
||||
|
||||
Reference in New Issue
Block a user