1{ stdenv, fetchFromGitHub, makeWrapper
2, go, sqlite, iproute, bridge-utils, devicemapper
3, btrfs-progs, iptables, e2fsprogs, xz, utillinux
4, systemd, pkgconfig
5}:
6
7# https://github.com/docker/docker/blob/master/project/PACKAGERS.md
8
9with stdenv.lib;
10
11stdenv.mkDerivation rec {
12 name = "docker-${version}";
13 version = "1.10.3";
14
15 src = fetchFromGitHub {
16 owner = "docker";
17 repo = "docker";
18 rev = "v${version}";
19 sha256 = "0bmrafi0p3fm681y165ps97jki0a8ihl9f0bmpvi22nmc1v0sv6l";
20 };
21
22 buildInputs = [
23 makeWrapper go sqlite iproute bridge-utils devicemapper btrfs-progs
24 iptables e2fsprogs systemd pkgconfig stdenv.glibc stdenv.glibc.static
25 ];
26
27 dontStrip = true;
28
29 DOCKER_BUILDTAGS = [ "journald" ]
30 ++ optional (btrfs-progs == null) "exclude_graphdriver_btrfs"
31 ++ optional (devicemapper == null) "exclude_graphdriver_devicemapper";
32
33 # systemd 230 no longer has libsystemd-journal as a separate entity from libsystemd
34 postPatch = ''
35 substituteInPlace ./hack/make.sh --replace libsystemd-journal libsystemd
36 substituteInPlace ./daemon/logger/journald/read.go --replace libsystemd-journal libsystemd
37 '';
38
39 buildPhase = ''
40 patchShebangs .
41 export AUTO_GOPATH=1
42 export DOCKER_GITCOMMIT="20f81dde"
43 ./hack/make.sh dynbinary
44 '';
45
46 installPhase = ''
47 install -Dm755 ./bundles/${version}/dynbinary/docker-${version} $out/libexec/docker/docker
48 install -Dm755 ./bundles/${version}/dynbinary/dockerinit-${version} $out/libexec/docker/dockerinit
49 makeWrapper $out/libexec/docker/docker $out/bin/docker \
50 --prefix PATH : "${stdenv.lib.makeBinPath [ iproute iptables e2fsprogs xz utillinux ]}"
51
52 # systemd
53 install -Dm644 ./contrib/init/systemd/docker.service $out/etc/systemd/system/docker.service
54
55 # completion
56 install -Dm644 ./contrib/completion/bash/docker $out/share/bash-completion/completions/docker
57 install -Dm644 ./contrib/completion/fish/docker.fish $out/share/fish/vendor_completions.d/docker.fish
58 install -Dm644 ./contrib/completion/zsh/_docker $out/share/zsh/site-functions/_docker
59 '';
60
61 meta = with stdenv.lib; {
62 homepage = http://www.docker.com/;
63 description = "An open source project to pack, ship and run any application as a lightweight container";
64 license = licenses.asl20;
65 maintainers = with maintainers; [ offline tailhook ];
66 platforms = platforms.linux;
67 };
68}