2016-09-10 11:45:01 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, makeWrapper, pkgconfig, go-md2man
|
2017-01-17 14:49:32 +00:00
|
|
|
, go, containerd, runc, docker-proxy, tini
|
2016-09-10 11:45:01 +01:00
|
|
|
, sqlite, iproute, bridge-utils, devicemapper, systemd
|
|
|
|
, btrfs-progs, iptables, e2fsprogs, xz, utillinux, xfsprogs
|
|
|
|
, procps
|
2015-11-16 15:17:32 +00:00
|
|
|
}:
|
2014-01-24 13:39:43 +00:00
|
|
|
|
2015-08-27 12:22:29 +01:00
|
|
|
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md
|
|
|
|
|
2016-09-10 11:45:01 +01:00
|
|
|
with lib;
|
2015-11-16 15:17:32 +00:00
|
|
|
|
2014-01-24 13:39:43 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "docker-${version}";
|
2017-01-17 14:49:32 +00:00
|
|
|
version = "1.13.0";
|
2017-01-23 09:32:17 +00:00
|
|
|
rev = "49bf474"; # should match the version commit
|
2014-01-24 13:39:43 +00:00
|
|
|
|
2015-08-04 04:16:03 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "docker";
|
|
|
|
repo = "docker";
|
|
|
|
rev = "v${version}";
|
2017-01-17 14:49:32 +00:00
|
|
|
sha256 = "03b181xiqgnwanc567w9p6rbdgdvrfv0lk4r7b604ksm0fr4cz23";
|
2014-01-24 13:39:43 +00:00
|
|
|
};
|
|
|
|
|
2017-01-17 14:49:32 +00:00
|
|
|
docker-runc = runc.overrideAttrs (oldAttrs: rec {
|
|
|
|
name = "docker-runc";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "docker";
|
|
|
|
repo = "runc";
|
|
|
|
rev = "2f7393a47307a16f8cee44a37b262e8b81021e3e";
|
|
|
|
sha256 = "1s5nfnbinzmcnm8avhvsniz0ihxyva4w5qz1hzzyqdyr0w2scnbj";
|
|
|
|
};
|
|
|
|
# docker/runc already include these patches / are not applicable
|
|
|
|
patches = [];
|
|
|
|
});
|
|
|
|
docker-containerd = containerd.overrideAttrs (oldAttrs: rec {
|
|
|
|
name = "docker-containerd";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "docker";
|
|
|
|
repo = "containerd";
|
|
|
|
rev = "03e5862ec0d8d3b3f750e19fca3ee367e13c090e";
|
|
|
|
sha256 = "184sd9dwkcba3zhxnz9grw8p81x05977p36cif2dgkhjdhv12map";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
docker-tini = tini.overrideAttrs (oldAttrs: rec {
|
|
|
|
name = "docker-init";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "krallin";
|
|
|
|
repo = "tini";
|
|
|
|
rev = "949e6facb77383876aeff8a6944dde66b3089574";
|
|
|
|
sha256 = "0zj4kdis1vvc6dwn4gplqna0bs7v6d1y2zc8v80s3zi018inhznw";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Do not remove static from make files as we want a static binary
|
|
|
|
patchPhase = ''
|
|
|
|
'';
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = [
|
|
|
|
"-DMINIMAL=ON"
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2015-11-16 15:17:32 +00:00
|
|
|
buildInputs = [
|
2016-09-10 11:45:01 +01:00
|
|
|
makeWrapper pkgconfig go-md2man go
|
|
|
|
sqlite devicemapper btrfs-progs systemd
|
2015-11-16 15:17:32 +00:00
|
|
|
];
|
2014-01-24 13:39:43 +00:00
|
|
|
|
2014-07-27 23:00:59 +01:00
|
|
|
dontStrip = true;
|
2014-01-24 13:39:43 +00:00
|
|
|
|
2016-09-10 11:45:01 +01:00
|
|
|
DOCKER_BUILDTAGS = []
|
|
|
|
++ optional (systemd != null) [ "journald" ]
|
2016-04-16 23:40:28 +01:00
|
|
|
++ optional (btrfs-progs == null) "exclude_graphdriver_btrfs"
|
|
|
|
++ optional (devicemapper == null) "exclude_graphdriver_devicemapper";
|
2016-01-14 02:40:26 +00:00
|
|
|
|
2016-05-27 15:41:05 +01:00
|
|
|
# systemd 230 no longer has libsystemd-journal as a separate entity from libsystemd
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace ./hack/make.sh --replace libsystemd-journal libsystemd
|
|
|
|
substituteInPlace ./daemon/logger/journald/read.go --replace libsystemd-journal libsystemd
|
|
|
|
'';
|
|
|
|
|
2014-01-24 13:39:43 +00:00
|
|
|
buildPhase = ''
|
2015-05-10 11:26:53 +01:00
|
|
|
patchShebangs .
|
2014-04-07 06:33:34 +01:00
|
|
|
export AUTO_GOPATH=1
|
2017-01-23 09:32:17 +00:00
|
|
|
export DOCKER_GITCOMMIT="${rev}"
|
2015-04-25 14:46:35 +01:00
|
|
|
./hack/make.sh dynbinary
|
2014-01-24 13:39:43 +00:00
|
|
|
'';
|
|
|
|
|
2016-09-10 11:45:01 +01:00
|
|
|
outputs = ["out" "man"];
|
|
|
|
|
|
|
|
extraPath = makeBinPath [ iproute iptables e2fsprogs xz xfsprogs procps utillinux ];
|
|
|
|
|
2014-01-24 13:39:43 +00:00
|
|
|
installPhase = ''
|
2016-09-10 11:45:01 +01:00
|
|
|
install -Dm755 ./bundles/${version}/dynbinary-client/docker-${version} $out/libexec/docker/docker
|
|
|
|
install -Dm755 ./bundles/${version}/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
|
2015-11-16 15:17:32 +00:00
|
|
|
makeWrapper $out/libexec/docker/docker $out/bin/docker \
|
2016-09-10 11:45:01 +01:00
|
|
|
--prefix PATH : "$out/libexec/docker:$extraPath"
|
|
|
|
makeWrapper $out/libexec/docker/dockerd $out/bin/dockerd \
|
|
|
|
--prefix PATH : "$out/libexec/docker:$extraPath"
|
|
|
|
|
|
|
|
# docker uses containerd now
|
2017-01-17 14:49:32 +00:00
|
|
|
ln -s ${docker-containerd}/bin/containerd $out/libexec/docker/docker-containerd
|
|
|
|
ln -s ${docker-containerd}/bin/containerd-shim $out/libexec/docker/docker-containerd-shim
|
|
|
|
ln -s ${docker-runc}/bin/runc $out/libexec/docker/docker-runc
|
|
|
|
ln -s ${docker-proxy}/bin/docker-proxy $out/libexec/docker/docker-proxy
|
|
|
|
ln -s ${docker-tini}/bin/tini-static $out/libexec/docker/docker-init
|
2014-01-24 13:39:43 +00:00
|
|
|
|
|
|
|
# systemd
|
|
|
|
install -Dm644 ./contrib/init/systemd/docker.service $out/etc/systemd/system/docker.service
|
|
|
|
|
|
|
|
# completion
|
|
|
|
install -Dm644 ./contrib/completion/bash/docker $out/share/bash-completion/completions/docker
|
2016-06-20 21:36:03 +01:00
|
|
|
install -Dm644 ./contrib/completion/fish/docker.fish $out/share/fish/vendor_completions.d/docker.fish
|
2014-01-24 13:39:43 +00:00
|
|
|
install -Dm644 ./contrib/completion/zsh/_docker $out/share/zsh/site-functions/_docker
|
2016-09-10 11:45:01 +01:00
|
|
|
|
|
|
|
# Include contributed man pages
|
|
|
|
man/md2man-all.sh -q
|
|
|
|
manRoot="$man/share/man"
|
|
|
|
mkdir -p "$manRoot"
|
|
|
|
for manDir in man/man?; do
|
|
|
|
manBase="$(basename "$manDir")" # "man1"
|
|
|
|
for manFile in "$manDir"/*; do
|
|
|
|
manName="$(basename "$manFile")" # "docker-build.1"
|
|
|
|
mkdir -p "$manRoot/$manBase"
|
|
|
|
gzip -c "$manFile" > "$manRoot/$manBase/$manName.gz"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
# remove references to go compiler, gcc and glibc
|
|
|
|
while read file; do
|
|
|
|
sed -ri "s,${go},$(echo "${go}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
|
|
|
|
sed -ri "s,${stdenv.cc.cc},$(echo "${stdenv.cc.cc}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
|
|
|
|
sed -ri "s,${stdenv.glibc.dev},$(echo "${stdenv.glibc.dev}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" $file
|
|
|
|
done < <(find $out -type f 2>/dev/null)
|
2014-01-24 13:39:43 +00:00
|
|
|
'';
|
|
|
|
|
2016-09-10 11:45:01 +01:00
|
|
|
meta = {
|
2015-08-04 04:16:03 +01:00
|
|
|
homepage = http://www.docker.com/;
|
2014-01-24 13:39:43 +00:00
|
|
|
description = "An open source project to pack, ship and run any application as a lightweight container";
|
|
|
|
license = licenses.asl20;
|
2014-07-27 23:00:59 +01:00
|
|
|
maintainers = with maintainers; [ offline tailhook ];
|
2014-01-24 13:39:43 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|