2020-05-10 02:24:03 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, makeWrapper, removeReferencesTo, installShellFiles, pkgconfig
|
2017-07-10 08:56:51 +01:00
|
|
|
, go-md2man, go, containerd, runc, docker-proxy, tini, libtool
|
2018-07-21 01:44:44 +01:00
|
|
|
, sqlite, iproute, lvm2, systemd
|
2020-04-18 20:27:14 +01:00
|
|
|
, btrfs-progs, iptables, e2fsprogs, xz, utillinux, xfsprogs, git
|
2017-07-22 19:27:44 +01:00
|
|
|
, procps, libseccomp
|
2015-11-16 15:17:32 +00:00
|
|
|
}:
|
2014-01-24 13:39:43 +00:00
|
|
|
|
2016-09-10 11:45:01 +01:00
|
|
|
with lib;
|
2015-11-16 15:17:32 +00:00
|
|
|
|
2017-04-04 13:03:55 +01:00
|
|
|
rec {
|
|
|
|
dockerGen = {
|
|
|
|
version, rev, sha256
|
|
|
|
, runcRev, runcSha256
|
|
|
|
, containerdRev, containerdSha256
|
|
|
|
, tiniRev, tiniSha256
|
2017-11-16 11:48:28 +00:00
|
|
|
} :
|
|
|
|
let
|
2019-08-13 22:52:01 +01:00
|
|
|
docker-runc = runc.overrideAttrs (oldAttrs: {
|
2018-11-04 23:35:13 +00:00
|
|
|
name = "docker-runc-${version}";
|
|
|
|
inherit version;
|
2017-04-04 13:03:55 +01:00
|
|
|
src = fetchFromGitHub {
|
2019-10-19 14:39:09 +01:00
|
|
|
owner = "opencontainers";
|
2017-04-04 13:03:55 +01:00
|
|
|
repo = "runc";
|
|
|
|
rev = runcRev;
|
|
|
|
sha256 = runcSha256;
|
|
|
|
};
|
|
|
|
# docker/runc already include these patches / are not applicable
|
|
|
|
patches = [];
|
|
|
|
});
|
2017-11-16 11:48:28 +00:00
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
docker-containerd = containerd.overrideAttrs (oldAttrs: {
|
2018-11-04 23:35:13 +00:00
|
|
|
name = "docker-containerd-${version}";
|
|
|
|
inherit version;
|
2017-04-04 13:03:55 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "docker";
|
|
|
|
repo = "containerd";
|
|
|
|
rev = containerdRev;
|
|
|
|
sha256 = containerdSha256;
|
|
|
|
};
|
|
|
|
});
|
2017-11-16 11:48:28 +00:00
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
docker-tini = tini.overrideAttrs (oldAttrs: {
|
2018-11-04 23:35:13 +00:00
|
|
|
name = "docker-init-${version}";
|
|
|
|
inherit version;
|
2017-04-04 13:03:55 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "krallin";
|
|
|
|
repo = "tini";
|
|
|
|
rev = tiniRev;
|
|
|
|
sha256 = tiniSha256;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Do not remove static from make files as we want a static binary
|
|
|
|
patchPhase = ''
|
|
|
|
'';
|
|
|
|
|
2019-10-30 01:29:30 +00:00
|
|
|
NIX_CFLAGS_COMPILE = "-DMINIMAL=ON";
|
2017-04-04 13:03:55 +01:00
|
|
|
});
|
2017-11-16 11:48:28 +00:00
|
|
|
in
|
2019-08-13 22:52:01 +01:00
|
|
|
stdenv.mkDerivation ((optionalAttrs (stdenv.isLinux) {
|
2017-11-16 11:48:28 +00:00
|
|
|
|
2017-11-20 19:16:08 +00:00
|
|
|
inherit docker-runc docker-containerd docker-proxy docker-tini;
|
2017-11-16 11:48:28 +00:00
|
|
|
|
|
|
|
DOCKER_BUILDTAGS = []
|
|
|
|
++ optional (systemd != null) [ "journald" ]
|
|
|
|
++ optional (btrfs-progs == null) "exclude_graphdriver_btrfs"
|
2018-07-17 21:11:16 +01:00
|
|
|
++ optional (lvm2 == null) "exclude_graphdriver_devicemapper"
|
2017-11-16 11:48:28 +00:00
|
|
|
++ optional (libseccomp != null) "seccomp";
|
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
}) // {
|
2017-11-16 11:48:28 +00:00
|
|
|
inherit version rev;
|
|
|
|
|
|
|
|
name = "docker-${version}";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "docker";
|
|
|
|
repo = "docker-ce";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = sha256;
|
|
|
|
};
|
2017-04-04 13:03:55 +01:00
|
|
|
|
2020-05-10 02:24:03 +01:00
|
|
|
nativeBuildInputs = [ installShellFiles pkgconfig ];
|
2017-04-04 13:03:55 +01:00
|
|
|
buildInputs = [
|
2017-11-16 11:48:28 +00:00
|
|
|
makeWrapper removeReferencesTo go-md2man go libtool
|
|
|
|
] ++ optionals (stdenv.isLinux) [
|
2018-07-17 21:11:16 +01:00
|
|
|
sqlite lvm2 btrfs-progs systemd libseccomp
|
2017-04-04 13:03:55 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
2019-03-10 20:54:19 +00:00
|
|
|
buildPhase = ''
|
|
|
|
export GOCACHE="$TMPDIR/go-cache"
|
|
|
|
'' + (optionalString (stdenv.isLinux) ''
|
2017-07-10 08:56:51 +01:00
|
|
|
# build engine
|
|
|
|
cd ./components/engine
|
2017-04-04 13:03:55 +01:00
|
|
|
export AUTO_GOPATH=1
|
|
|
|
export DOCKER_GITCOMMIT="${rev}"
|
2018-01-02 12:33:04 +00:00
|
|
|
export VERSION="${version}"
|
2017-04-04 13:03:55 +01:00
|
|
|
./hack/make.sh dynbinary
|
2017-07-10 08:56:51 +01:00
|
|
|
cd -
|
2017-11-16 11:48:28 +00:00
|
|
|
'') + ''
|
2017-07-10 08:56:51 +01:00
|
|
|
# build cli
|
|
|
|
cd ./components/cli
|
|
|
|
# Mimic AUTO_GOPATH
|
|
|
|
mkdir -p .gopath/src/github.com/docker/
|
|
|
|
ln -sf $PWD .gopath/src/github.com/docker/cli
|
|
|
|
export GOPATH="$PWD/.gopath:$GOPATH"
|
|
|
|
export GITCOMMIT="${rev}"
|
|
|
|
export VERSION="${version}"
|
|
|
|
source ./scripts/build/.variables
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
go build -tags pkcs11 --ldflags "$LDFLAGS" github.com/docker/cli/cmd/docker
|
|
|
|
cd -
|
2017-04-04 13:03:55 +01:00
|
|
|
'';
|
|
|
|
|
2017-07-10 08:56:51 +01:00
|
|
|
# systemd 230 no longer has libsystemd-journal as a separate entity from libsystemd
|
|
|
|
patchPhase = ''
|
2017-11-16 11:48:28 +00:00
|
|
|
substituteInPlace ./components/cli/scripts/build/.variables --replace "set -eu" ""
|
|
|
|
'' + optionalString (stdenv.isLinux) ''
|
2017-07-10 08:56:51 +01:00
|
|
|
patchShebangs .
|
|
|
|
substituteInPlace ./components/engine/hack/make.sh --replace libsystemd-journal libsystemd
|
|
|
|
substituteInPlace ./components/engine/daemon/logger/journald/read.go --replace libsystemd-journal libsystemd
|
2017-11-16 11:48:28 +00:00
|
|
|
'';
|
2017-07-10 08:56:51 +01:00
|
|
|
|
2017-04-04 13:03:55 +01:00
|
|
|
outputs = ["out" "man"];
|
|
|
|
|
2020-04-18 20:27:14 +01:00
|
|
|
extraPath = optionals (stdenv.isLinux) (makeBinPath [ iproute iptables e2fsprogs xz xfsprogs procps utillinux git ]);
|
2017-10-17 22:22:25 +01:00
|
|
|
|
2017-11-16 11:48:28 +00:00
|
|
|
installPhase = optionalString (stdenv.isLinux) ''
|
2018-01-02 12:33:04 +00:00
|
|
|
install -Dm755 ./components/engine/bundles/dynbinary-daemon/dockerd $out/libexec/docker/dockerd
|
2017-10-17 22:22:25 +01:00
|
|
|
|
2017-04-04 13:03:55 +01:00
|
|
|
makeWrapper $out/libexec/docker/dockerd $out/bin/dockerd \
|
|
|
|
--prefix PATH : "$out/libexec/docker:$extraPath"
|
|
|
|
|
|
|
|
# docker uses containerd now
|
2018-11-11 00:26:12 +00:00
|
|
|
ln -s ${docker-containerd}/bin/containerd $out/libexec/docker/containerd
|
|
|
|
ln -s ${docker-containerd}/bin/containerd-shim $out/libexec/docker/containerd-shim
|
|
|
|
ln -s ${docker-runc}/bin/runc $out/libexec/docker/runc
|
2017-04-04 13:03:55 +01:00
|
|
|
ln -s ${docker-proxy}/bin/docker-proxy $out/libexec/docker/docker-proxy
|
|
|
|
ln -s ${docker-tini}/bin/tini-static $out/libexec/docker/docker-init
|
|
|
|
|
|
|
|
# systemd
|
2017-07-10 08:56:51 +01:00
|
|
|
install -Dm644 ./components/engine/contrib/init/systemd/docker.service $out/etc/systemd/system/docker.service
|
2017-11-16 11:48:28 +00:00
|
|
|
'' + ''
|
|
|
|
install -Dm755 ./components/cli/docker $out/libexec/docker/docker
|
|
|
|
|
|
|
|
makeWrapper $out/libexec/docker/docker $out/bin/docker \
|
|
|
|
--prefix PATH : "$out/libexec/docker:$extraPath"
|
2017-07-10 08:56:51 +01:00
|
|
|
|
|
|
|
# completion (cli)
|
2020-05-10 02:24:03 +01:00
|
|
|
installShellCompletion --bash ./components/cli/contrib/completion/bash/docker
|
|
|
|
installShellCompletion --fish ./components/cli/contrib/completion/fish/docker.fish
|
|
|
|
installShellCompletion --zsh ./components/cli/contrib/completion/zsh/_docker
|
2017-04-04 13:03:55 +01:00
|
|
|
|
2017-07-10 08:56:51 +01:00
|
|
|
# Include contributed man pages (cli)
|
|
|
|
# Generate man pages from cobra commands
|
|
|
|
echo "Generate man pages from cobra"
|
|
|
|
cd ./components/cli
|
|
|
|
mkdir -p ./man/man1
|
2017-07-21 08:54:41 +01:00
|
|
|
go build -o ./gen-manpages github.com/docker/cli/man
|
|
|
|
./gen-manpages --root . --target ./man/man1
|
2017-07-10 08:56:51 +01:00
|
|
|
|
|
|
|
# Generate legacy pages from markdown
|
|
|
|
echo "Generate legacy manpages"
|
|
|
|
./man/md2man-all.sh -q
|
2017-04-04 13:03:55 +01:00
|
|
|
|
2020-05-10 02:24:03 +01:00
|
|
|
installManPage man/*/*.[1-9]
|
2017-04-04 13:03:55 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
preFixup = ''
|
2017-11-16 11:48:28 +00:00
|
|
|
find $out -type f -exec remove-references-to -t ${go} -t ${stdenv.cc.cc} '{}' +
|
|
|
|
'' + optionalString (stdenv.isLinux) ''
|
|
|
|
find $out -type f -exec remove-references-to -t ${stdenv.glibc.dev} '{}' +
|
2017-04-04 13:03:55 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.docker.com/";
|
2017-04-04 13:03:55 +01:00
|
|
|
description = "An open source project to pack, ship and run any application as a lightweight container";
|
|
|
|
license = licenses.asl20;
|
2017-11-16 11:48:28 +00:00
|
|
|
maintainers = with maintainers; [ nequissimus offline tailhook vdemeester periklis ];
|
2017-11-20 19:30:46 +00:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2017-04-04 13:03:55 +01:00
|
|
|
};
|
2017-11-16 11:48:28 +00:00
|
|
|
});
|
2017-04-04 13:03:55 +01:00
|
|
|
|
2017-08-12 20:37:36 +01:00
|
|
|
# Get revisions from
|
2019-10-19 14:39:09 +01:00
|
|
|
# https://github.com/docker/docker-ce/tree/${version}/components/engine/hack/dockerfile/install/*
|
2018-03-23 21:37:30 +00:00
|
|
|
|
2019-04-27 01:33:05 +01:00
|
|
|
docker_18_09 = makeOverridable dockerGen {
|
2019-09-09 13:59:03 +01:00
|
|
|
version = "18.09.9";
|
|
|
|
rev = "039a7df9ba8097dd987370782fcdd6ea79b26016";
|
|
|
|
sha256 = "0wqhjx9qs96q2jd091wffn3cyv2aslqn2cvpdpgljk8yr9s0yg7h";
|
2019-10-19 14:39:09 +01:00
|
|
|
runcRev = "3e425f80a8c931f88e6d94a8c831b9d5aa481657";
|
|
|
|
runcSha256 = "18psc830b2rkwml1x6vxngam5b5wi3pj14mw817rshpzy87prspj";
|
2019-07-04 01:14:58 +01:00
|
|
|
containerdRev = "894b81a4b802e4eb2a91d1ce216b8817763c29fb";
|
|
|
|
containerdSha256 = "0sp5mn5wd3xma4svm6hf67hyhiixzkzz6ijhyjkwdrc4alk81357";
|
2018-07-19 13:34:13 +01:00
|
|
|
tiniRev = "fec3683b971d9c3ef73f284f176672c44b448662";
|
|
|
|
tiniSha256 = "1h20i3wwlbd8x4jr2gz68hgklh0lb0jj7y5xk1wvr8y58fip1rdn";
|
2018-04-10 23:28:20 +01:00
|
|
|
};
|
2019-07-26 17:42:55 +01:00
|
|
|
|
|
|
|
docker_19_03 = makeOverridable dockerGen {
|
2020-06-01 16:44:02 +01:00
|
|
|
version = "19.03.11";
|
|
|
|
rev = "42e35e61f352e527082521280d5ea3761f0dee50";
|
|
|
|
sha256 = "0q4l4z2bg269hj1dqaq02f84zgp3p8idw1cxczw383cjl0ra8xgq";
|
2020-03-05 15:18:44 +00:00
|
|
|
runcRev = "dc9208a3303feef5b3839f4323d9beb36df0a9dd"; # v1.0.0-rc10
|
2020-02-13 04:17:47 +00:00
|
|
|
runcSha256 = "0pi3rvj585997m4z9ljkxz2z9yxf9p2jr0pmqbqrc7bc95f5hagk";
|
2020-03-05 15:18:44 +00:00
|
|
|
containerdRev = "7ad184331fa3e55e52b890ea95e65ba581ae3429"; # v1.2.13
|
|
|
|
containerdSha256 = "1rac3iak3jpz57yarxc72bxgxvravwrl0j6s6w2nxrmh2m3kxqzn";
|
|
|
|
tiniRev = "fec3683b971d9c3ef73f284f176672c44b448662"; # v0.18.0
|
2019-07-26 17:42:55 +01:00
|
|
|
tiniSha256 = "1h20i3wwlbd8x4jr2gz68hgklh0lb0jj7y5xk1wvr8y58fip1rdn";
|
|
|
|
};
|
2014-01-24 13:39:43 +00:00
|
|
|
}
|