docker-cli: enable darwin support
This commit is contained in:
parent
7be449a97d
commit
0f0ffa70a0
@ -13,18 +13,8 @@ rec {
|
|||||||
, runcRev, runcSha256
|
, runcRev, runcSha256
|
||||||
, containerdRev, containerdSha256
|
, containerdRev, containerdSha256
|
||||||
, tiniRev, tiniSha256
|
, tiniRev, tiniSha256
|
||||||
} : stdenv.mkDerivation rec {
|
} :
|
||||||
inherit version rev;
|
let
|
||||||
|
|
||||||
name = "docker-${version}";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "docker";
|
|
||||||
repo = "docker-ce";
|
|
||||||
rev = "v${version}";
|
|
||||||
sha256 = sha256;
|
|
||||||
};
|
|
||||||
|
|
||||||
docker-runc = runc.overrideAttrs (oldAttrs: rec {
|
docker-runc = runc.overrideAttrs (oldAttrs: rec {
|
||||||
name = "docker-runc";
|
name = "docker-runc";
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
@ -36,6 +26,7 @@ rec {
|
|||||||
# docker/runc already include these patches / are not applicable
|
# docker/runc already include these patches / are not applicable
|
||||||
patches = [];
|
patches = [];
|
||||||
});
|
});
|
||||||
|
|
||||||
docker-containerd = containerd.overrideAttrs (oldAttrs: rec {
|
docker-containerd = containerd.overrideAttrs (oldAttrs: rec {
|
||||||
name = "docker-containerd";
|
name = "docker-containerd";
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
@ -51,6 +42,7 @@ rec {
|
|||||||
mv $(pwd)/vendor/{github.com,golang.org,google.golang.org} $(pwd)/vendor/src/
|
mv $(pwd)/vendor/{github.com,golang.org,google.golang.org} $(pwd)/vendor/src/
|
||||||
'' + oldAttrs.preBuild;
|
'' + oldAttrs.preBuild;
|
||||||
});
|
});
|
||||||
|
|
||||||
docker-tini = tini.overrideAttrs (oldAttrs: rec {
|
docker-tini = tini.overrideAttrs (oldAttrs: rec {
|
||||||
name = "docker-init";
|
name = "docker-init";
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
@ -68,17 +60,10 @@ rec {
|
|||||||
"-DMINIMAL=ON"
|
"-DMINIMAL=ON"
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation ((optionalAttrs (stdenv.isLinux) rec {
|
||||||
|
|
||||||
# Optimizations break compilation of libseccomp c bindings
|
inherit docker-runc docker-containerd docker-tini;
|
||||||
hardeningDisable = [ "fortify" ];
|
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig ];
|
|
||||||
buildInputs = [
|
|
||||||
makeWrapper removeReferencesTo go-md2man go
|
|
||||||
sqlite devicemapper btrfs-progs systemd libtool libseccomp
|
|
||||||
];
|
|
||||||
|
|
||||||
dontStrip = true;
|
|
||||||
|
|
||||||
DOCKER_BUILDTAGS = []
|
DOCKER_BUILDTAGS = []
|
||||||
++ optional (systemd != null) [ "journald" ]
|
++ optional (systemd != null) [ "journald" ]
|
||||||
@ -86,14 +71,38 @@ rec {
|
|||||||
++ optional (devicemapper == null) "exclude_graphdriver_devicemapper"
|
++ optional (devicemapper == null) "exclude_graphdriver_devicemapper"
|
||||||
++ optional (libseccomp != null) "seccomp";
|
++ optional (libseccomp != null) "seccomp";
|
||||||
|
|
||||||
buildPhase = ''
|
}) // rec {
|
||||||
|
inherit version rev;
|
||||||
|
|
||||||
|
name = "docker-${version}";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "docker";
|
||||||
|
repo = "docker-ce";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = sha256;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Optimizations break compilation of libseccomp c bindings
|
||||||
|
hardeningDisable = [ "fortify" ];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ pkgconfig ];
|
||||||
|
buildInputs = [
|
||||||
|
makeWrapper removeReferencesTo go-md2man go libtool
|
||||||
|
] ++ optionals (stdenv.isLinux) [
|
||||||
|
sqlite devicemapper btrfs-progs systemd libtool libseccomp
|
||||||
|
];
|
||||||
|
|
||||||
|
dontStrip = true;
|
||||||
|
|
||||||
|
buildPhase = (optionalString (stdenv.isLinux) ''
|
||||||
# build engine
|
# build engine
|
||||||
cd ./components/engine
|
cd ./components/engine
|
||||||
export AUTO_GOPATH=1
|
export AUTO_GOPATH=1
|
||||||
export DOCKER_GITCOMMIT="${rev}"
|
export DOCKER_GITCOMMIT="${rev}"
|
||||||
./hack/make.sh dynbinary
|
./hack/make.sh dynbinary
|
||||||
cd -
|
cd -
|
||||||
|
'') + ''
|
||||||
# build cli
|
# build cli
|
||||||
cd ./components/cli
|
cd ./components/cli
|
||||||
# Mimic AUTO_GOPATH
|
# Mimic AUTO_GOPATH
|
||||||
@ -110,27 +119,24 @@ rec {
|
|||||||
|
|
||||||
# systemd 230 no longer has libsystemd-journal as a separate entity from libsystemd
|
# systemd 230 no longer has libsystemd-journal as a separate entity from libsystemd
|
||||||
patchPhase = ''
|
patchPhase = ''
|
||||||
|
substituteInPlace ./components/cli/scripts/build/.variables --replace "set -eu" ""
|
||||||
|
'' + optionalString (stdenv.isLinux) ''
|
||||||
patchShebangs .
|
patchShebangs .
|
||||||
substituteInPlace ./components/engine/hack/make.sh --replace libsystemd-journal libsystemd
|
substituteInPlace ./components/engine/hack/make.sh --replace libsystemd-journal libsystemd
|
||||||
substituteInPlace ./components/engine/daemon/logger/journald/read.go --replace libsystemd-journal libsystemd
|
substituteInPlace ./components/engine/daemon/logger/journald/read.go --replace libsystemd-journal libsystemd
|
||||||
substituteInPlace ./components/cli/scripts/build/.variables --replace "set -eu" ""
|
'';
|
||||||
'';
|
|
||||||
|
|
||||||
outputs = ["out" "man"];
|
outputs = ["out" "man"];
|
||||||
|
|
||||||
extraPath = makeBinPath [ iproute iptables e2fsprogs xz xfsprogs procps utillinux ];
|
extraPath = optionals (stdenv.isLinux) (makeBinPath [ iproute iptables e2fsprogs xz xfsprogs procps utillinux ]);
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
install -Dm755 ./components/cli/docker $out/libexec/docker/docker
|
|
||||||
|
|
||||||
|
installPhase = optionalString (stdenv.isLinux) ''
|
||||||
if [ -d "./components/engine/bundles/${version}" ]; then
|
if [ -d "./components/engine/bundles/${version}" ]; then
|
||||||
install -Dm755 ./components/engine/bundles/${version}/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
|
install -Dm755 ./components/engine/bundles/${version}/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
|
||||||
else
|
else
|
||||||
install -Dm755 ./components/engine/bundles/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
|
install -Dm755 ./components/engine/bundles/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
makeWrapper $out/libexec/docker/docker $out/bin/docker \
|
|
||||||
--prefix PATH : "$out/libexec/docker:$extraPath"
|
|
||||||
makeWrapper $out/libexec/docker/dockerd $out/bin/dockerd \
|
makeWrapper $out/libexec/docker/dockerd $out/bin/dockerd \
|
||||||
--prefix PATH : "$out/libexec/docker:$extraPath"
|
--prefix PATH : "$out/libexec/docker:$extraPath"
|
||||||
|
|
||||||
@ -143,6 +149,11 @@ rec {
|
|||||||
|
|
||||||
# systemd
|
# systemd
|
||||||
install -Dm644 ./components/engine/contrib/init/systemd/docker.service $out/etc/systemd/system/docker.service
|
install -Dm644 ./components/engine/contrib/init/systemd/docker.service $out/etc/systemd/system/docker.service
|
||||||
|
'' + ''
|
||||||
|
install -Dm755 ./components/cli/docker $out/libexec/docker/docker
|
||||||
|
|
||||||
|
makeWrapper $out/libexec/docker/docker $out/bin/docker \
|
||||||
|
--prefix PATH : "$out/libexec/docker:$extraPath"
|
||||||
|
|
||||||
# completion (cli)
|
# completion (cli)
|
||||||
install -Dm644 ./components/cli/contrib/completion/bash/docker $out/share/bash-completion/completions/docker
|
install -Dm644 ./components/cli/contrib/completion/bash/docker $out/share/bash-completion/completions/docker
|
||||||
@ -174,17 +185,19 @@ rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
preFixup = ''
|
preFixup = ''
|
||||||
find $out -type f -exec remove-references-to -t ${go} -t ${stdenv.cc.cc} -t ${stdenv.glibc.dev} '{}' +
|
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} '{}' +
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = https://www.docker.com/;
|
homepage = https://www.docker.com/;
|
||||||
description = "An open source project to pack, ship and run any application as a lightweight container";
|
description = "An open source project to pack, ship and run any application as a lightweight container";
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
maintainers = with maintainers; [ nequissimus offline tailhook vdemeester ];
|
maintainers = with maintainers; [ nequissimus offline tailhook vdemeester periklis ];
|
||||||
platforms = platforms.linux;
|
platforms = with platforms; [ linux darwin ];
|
||||||
};
|
};
|
||||||
};
|
});
|
||||||
|
|
||||||
# Get revisions from
|
# Get revisions from
|
||||||
# https://github.com/docker/docker-ce/blob/v${version}/components/engine/hack/dockerfile/binaries-commits
|
# https://github.com/docker/docker-ce/blob/v${version}/components/engine/hack/dockerfile/binaries-commits
|
||||||
|
Loading…
x
Reference in New Issue
Block a user