Merge pull request #31737 from periklis/init-docker-darwin-support
docker & docker-machine-xhyve: enable darwin support
This commit is contained in:
commit
a6172a90be
@ -0,0 +1,21 @@
|
||||
# This file was generated by https://github.com/kamilchm/go2nix v1.2.1
|
||||
[
|
||||
{
|
||||
goPackagePath = "github.com/docker/machine";
|
||||
fetch = {
|
||||
type = "git";
|
||||
url = "https://github.com/docker/machine";
|
||||
rev = "5b274558ea6ca822c06dd407a4e774a0105c3f60";
|
||||
sha256 = "1wdq9h4bx7awgclh969gvmcnl9jvgv7ldfklnclh5iv47mi7q22d";
|
||||
};
|
||||
}
|
||||
{
|
||||
goPackagePath = "github.com/zchee/libhyperkit";
|
||||
fetch = {
|
||||
type = "git";
|
||||
url = "https://github.com/zchee/libhyperkit";
|
||||
rev = "1a19a7693fac32b46ec6cdd22da6fbec974447fc";
|
||||
sha256 = "119f5gcl24znwnmi837jk667asd3lirx32jldpd4mbyb3sm9nz24";
|
||||
};
|
||||
}
|
||||
]
|
@ -0,0 +1,27 @@
|
||||
{ stdenv, buildGoPackage, fetchFromGitHub, pkgconfig, Hypervisor, vmnet }:
|
||||
|
||||
buildGoPackage rec {
|
||||
name = "docker-machine-xhyve-${version}";
|
||||
version = "0.3.3";
|
||||
|
||||
goPackagePath = "github.com/zchee/docker-machine-driver-xhyve";
|
||||
goDeps = ./xhyve-deps.nix;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
rev = "v${version}";
|
||||
owner = "zchee";
|
||||
repo = "docker-machine-driver-xhyve";
|
||||
sha256 = "0rj6pyqp4yv4j28bglqjs95rip5i77vv8mrkmqv1rxrsl3i8aqqy";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
buildInputs = [ Hypervisor vmnet ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = https://github.com/zchee/docker-machine-driver-xhyve;
|
||||
description = "Xhyve driver for docker-machine.";
|
||||
license = licenses.bsd3;
|
||||
maintainers = with maintainers; [ periklis ];
|
||||
platforms = platforms.darwin;
|
||||
};
|
||||
}
|
@ -13,18 +13,8 @@ rec {
|
||||
, runcRev, runcSha256
|
||||
, containerdRev, containerdSha256
|
||||
, tiniRev, tiniSha256
|
||||
} : stdenv.mkDerivation rec {
|
||||
inherit version rev;
|
||||
|
||||
name = "docker-${version}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "docker";
|
||||
repo = "docker-ce";
|
||||
rev = "v${version}";
|
||||
sha256 = sha256;
|
||||
};
|
||||
|
||||
} :
|
||||
let
|
||||
docker-runc = runc.overrideAttrs (oldAttrs: rec {
|
||||
name = "docker-runc";
|
||||
src = fetchFromGitHub {
|
||||
@ -36,6 +26,7 @@ rec {
|
||||
# docker/runc already include these patches / are not applicable
|
||||
patches = [];
|
||||
});
|
||||
|
||||
docker-containerd = containerd.overrideAttrs (oldAttrs: rec {
|
||||
name = "docker-containerd";
|
||||
src = fetchFromGitHub {
|
||||
@ -51,6 +42,7 @@ rec {
|
||||
mv $(pwd)/vendor/{github.com,golang.org,google.golang.org} $(pwd)/vendor/src/
|
||||
'' + oldAttrs.preBuild;
|
||||
});
|
||||
|
||||
docker-tini = tini.overrideAttrs (oldAttrs: rec {
|
||||
name = "docker-init";
|
||||
src = fetchFromGitHub {
|
||||
@ -68,17 +60,10 @@ rec {
|
||||
"-DMINIMAL=ON"
|
||||
];
|
||||
});
|
||||
in
|
||||
stdenv.mkDerivation ((optionalAttrs (stdenv.isLinux) rec {
|
||||
|
||||
# Optimizations break compilation of libseccomp c bindings
|
||||
hardeningDisable = [ "fortify" ];
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
buildInputs = [
|
||||
makeWrapper removeReferencesTo go-md2man go
|
||||
sqlite devicemapper btrfs-progs systemd libtool libseccomp
|
||||
];
|
||||
|
||||
dontStrip = true;
|
||||
inherit docker-runc docker-containerd docker-proxy docker-tini;
|
||||
|
||||
DOCKER_BUILDTAGS = []
|
||||
++ optional (systemd != null) [ "journald" ]
|
||||
@ -86,14 +71,38 @@ rec {
|
||||
++ optional (devicemapper == null) "exclude_graphdriver_devicemapper"
|
||||
++ 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
|
||||
cd ./components/engine
|
||||
export AUTO_GOPATH=1
|
||||
export DOCKER_GITCOMMIT="${rev}"
|
||||
./hack/make.sh dynbinary
|
||||
cd -
|
||||
|
||||
'') + ''
|
||||
# build cli
|
||||
cd ./components/cli
|
||||
# Mimic AUTO_GOPATH
|
||||
@ -110,27 +119,24 @@ rec {
|
||||
|
||||
# systemd 230 no longer has libsystemd-journal as a separate entity from libsystemd
|
||||
patchPhase = ''
|
||||
substituteInPlace ./components/cli/scripts/build/.variables --replace "set -eu" ""
|
||||
'' + optionalString (stdenv.isLinux) ''
|
||||
patchShebangs .
|
||||
substituteInPlace ./components/engine/hack/make.sh --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"];
|
||||
|
||||
extraPath = makeBinPath [ iproute iptables e2fsprogs xz xfsprogs procps utillinux ];
|
||||
|
||||
installPhase = ''
|
||||
install -Dm755 ./components/cli/docker $out/libexec/docker/docker
|
||||
extraPath = optionals (stdenv.isLinux) (makeBinPath [ iproute iptables e2fsprogs xz xfsprogs procps utillinux ]);
|
||||
|
||||
installPhase = optionalString (stdenv.isLinux) ''
|
||||
if [ -d "./components/engine/bundles/${version}" ]; then
|
||||
install -Dm755 ./components/engine/bundles/${version}/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
|
||||
else
|
||||
install -Dm755 ./components/engine/bundles/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
|
||||
fi
|
||||
|
||||
makeWrapper $out/libexec/docker/docker $out/bin/docker \
|
||||
--prefix PATH : "$out/libexec/docker:$extraPath"
|
||||
makeWrapper $out/libexec/docker/dockerd $out/bin/dockerd \
|
||||
--prefix PATH : "$out/libexec/docker:$extraPath"
|
||||
|
||||
@ -143,6 +149,11 @@ rec {
|
||||
|
||||
# systemd
|
||||
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)
|
||||
install -Dm644 ./components/cli/contrib/completion/bash/docker $out/share/bash-completion/completions/docker
|
||||
@ -174,17 +185,19 @@ rec {
|
||||
'';
|
||||
|
||||
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 = {
|
||||
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; [ nequissimus offline tailhook vdemeester ];
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ nequissimus offline tailhook vdemeester periklis ];
|
||||
platforms = with platforms; linux ++ darwin;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
# Get revisions from
|
||||
# https://github.com/docker/docker-ce/blob/v${version}/components/engine/hack/dockerfile/binaries-commits
|
||||
|
@ -14250,6 +14250,9 @@ with pkgs;
|
||||
|
||||
docker-machine = callPackage ../applications/networking/cluster/docker-machine { };
|
||||
docker-machine-kvm = callPackage ../applications/networking/cluster/docker-machine/kvm.nix { };
|
||||
docker-machine-xhyve = callPackage ../applications/networking/cluster/docker-machine/xhyve.nix {
|
||||
inherit (darwin.apple_sdk.frameworks) Hypervisor vmnet;
|
||||
};
|
||||
|
||||
docker-distribution = callPackage ../applications/virtualization/docker-distribution { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user