tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
docker-cli: enable darwin support
Periklis Tsirakidis
8 years ago
0f0ffa70
7be449a9
+46
-33
1 changed file
expand all
collapse all
unified
split
pkgs
applications
virtualization
docker
default.nix
+46
-33
pkgs/applications/virtualization/docker/default.nix
···
13
13
, runcRev, runcSha256
14
14
, containerdRev, containerdSha256
15
15
, tiniRev, tiniSha256
16
16
-
} : stdenv.mkDerivation rec {
17
17
-
inherit version rev;
18
18
-
19
19
-
name = "docker-${version}";
20
20
-
21
21
-
src = fetchFromGitHub {
22
22
-
owner = "docker";
23
23
-
repo = "docker-ce";
24
24
-
rev = "v${version}";
25
25
-
sha256 = sha256;
26
26
-
};
27
27
-
16
16
+
} :
17
17
+
let
28
18
docker-runc = runc.overrideAttrs (oldAttrs: rec {
29
19
name = "docker-runc";
30
20
src = fetchFromGitHub {
···
36
26
# docker/runc already include these patches / are not applicable
37
27
patches = [];
38
28
});
29
29
+
39
30
docker-containerd = containerd.overrideAttrs (oldAttrs: rec {
40
31
name = "docker-containerd";
41
32
src = fetchFromGitHub {
···
51
42
mv $(pwd)/vendor/{github.com,golang.org,google.golang.org} $(pwd)/vendor/src/
52
43
'' + oldAttrs.preBuild;
53
44
});
45
45
+
54
46
docker-tini = tini.overrideAttrs (oldAttrs: rec {
55
47
name = "docker-init";
56
48
src = fetchFromGitHub {
···
68
60
"-DMINIMAL=ON"
69
61
];
70
62
});
63
63
+
in
64
64
+
stdenv.mkDerivation ((optionalAttrs (stdenv.isLinux) rec {
65
65
+
66
66
+
inherit docker-runc docker-containerd docker-tini;
67
67
+
68
68
+
DOCKER_BUILDTAGS = []
69
69
+
++ optional (systemd != null) [ "journald" ]
70
70
+
++ optional (btrfs-progs == null) "exclude_graphdriver_btrfs"
71
71
+
++ optional (devicemapper == null) "exclude_graphdriver_devicemapper"
72
72
+
++ optional (libseccomp != null) "seccomp";
73
73
+
74
74
+
}) // rec {
75
75
+
inherit version rev;
76
76
+
77
77
+
name = "docker-${version}";
78
78
+
79
79
+
src = fetchFromGitHub {
80
80
+
owner = "docker";
81
81
+
repo = "docker-ce";
82
82
+
rev = "v${version}";
83
83
+
sha256 = sha256;
84
84
+
};
71
85
72
86
# Optimizations break compilation of libseccomp c bindings
73
87
hardeningDisable = [ "fortify" ];
74
88
75
89
nativeBuildInputs = [ pkgconfig ];
76
90
buildInputs = [
77
77
-
makeWrapper removeReferencesTo go-md2man go
91
91
+
makeWrapper removeReferencesTo go-md2man go libtool
92
92
+
] ++ optionals (stdenv.isLinux) [
78
93
sqlite devicemapper btrfs-progs systemd libtool libseccomp
79
94
];
80
95
81
96
dontStrip = true;
82
97
83
83
-
DOCKER_BUILDTAGS = []
84
84
-
++ optional (systemd != null) [ "journald" ]
85
85
-
++ optional (btrfs-progs == null) "exclude_graphdriver_btrfs"
86
86
-
++ optional (devicemapper == null) "exclude_graphdriver_devicemapper"
87
87
-
++ optional (libseccomp != null) "seccomp";
88
88
-
89
89
-
buildPhase = ''
98
98
+
buildPhase = (optionalString (stdenv.isLinux) ''
90
99
# build engine
91
100
cd ./components/engine
92
101
export AUTO_GOPATH=1
93
102
export DOCKER_GITCOMMIT="${rev}"
94
103
./hack/make.sh dynbinary
95
104
cd -
96
96
-
105
105
+
'') + ''
97
106
# build cli
98
107
cd ./components/cli
99
108
# Mimic AUTO_GOPATH
···
110
119
111
120
# systemd 230 no longer has libsystemd-journal as a separate entity from libsystemd
112
121
patchPhase = ''
122
122
+
substituteInPlace ./components/cli/scripts/build/.variables --replace "set -eu" ""
123
123
+
'' + optionalString (stdenv.isLinux) ''
113
124
patchShebangs .
114
125
substituteInPlace ./components/engine/hack/make.sh --replace libsystemd-journal libsystemd
115
126
substituteInPlace ./components/engine/daemon/logger/journald/read.go --replace libsystemd-journal libsystemd
116
116
-
substituteInPlace ./components/cli/scripts/build/.variables --replace "set -eu" ""
117
117
-
'';
127
127
+
'';
118
128
119
129
outputs = ["out" "man"];
120
130
121
121
-
extraPath = makeBinPath [ iproute iptables e2fsprogs xz xfsprogs procps utillinux ];
131
131
+
extraPath = optionals (stdenv.isLinux) (makeBinPath [ iproute iptables e2fsprogs xz xfsprogs procps utillinux ]);
122
132
123
123
-
installPhase = ''
124
124
-
install -Dm755 ./components/cli/docker $out/libexec/docker/docker
125
125
-
133
133
+
installPhase = optionalString (stdenv.isLinux) ''
126
134
if [ -d "./components/engine/bundles/${version}" ]; then
127
135
install -Dm755 ./components/engine/bundles/${version}/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
128
136
else
129
137
install -Dm755 ./components/engine/bundles/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
130
138
fi
131
139
132
132
-
makeWrapper $out/libexec/docker/docker $out/bin/docker \
133
133
-
--prefix PATH : "$out/libexec/docker:$extraPath"
134
140
makeWrapper $out/libexec/docker/dockerd $out/bin/dockerd \
135
141
--prefix PATH : "$out/libexec/docker:$extraPath"
136
142
···
143
149
144
150
# systemd
145
151
install -Dm644 ./components/engine/contrib/init/systemd/docker.service $out/etc/systemd/system/docker.service
152
152
+
'' + ''
153
153
+
install -Dm755 ./components/cli/docker $out/libexec/docker/docker
154
154
+
155
155
+
makeWrapper $out/libexec/docker/docker $out/bin/docker \
156
156
+
--prefix PATH : "$out/libexec/docker:$extraPath"
146
157
147
158
# completion (cli)
148
159
install -Dm644 ./components/cli/contrib/completion/bash/docker $out/share/bash-completion/completions/docker
···
174
185
'';
175
186
176
187
preFixup = ''
177
177
-
find $out -type f -exec remove-references-to -t ${go} -t ${stdenv.cc.cc} -t ${stdenv.glibc.dev} '{}' +
188
188
+
find $out -type f -exec remove-references-to -t ${go} -t ${stdenv.cc.cc} '{}' +
189
189
+
'' + optionalString (stdenv.isLinux) ''
190
190
+
find $out -type f -exec remove-references-to -t ${stdenv.glibc.dev} '{}' +
178
191
'';
179
192
180
193
meta = {
181
194
homepage = https://www.docker.com/;
182
195
description = "An open source project to pack, ship and run any application as a lightweight container";
183
196
license = licenses.asl20;
184
184
-
maintainers = with maintainers; [ nequissimus offline tailhook vdemeester ];
185
185
-
platforms = platforms.linux;
197
197
+
maintainers = with maintainers; [ nequissimus offline tailhook vdemeester periklis ];
198
198
+
platforms = with platforms; [ linux darwin ];
186
199
};
187
187
-
};
200
200
+
});
188
201
189
202
# Get revisions from
190
203
# https://github.com/docker/docker-ce/blob/v${version}/components/engine/hack/dockerfile/binaries-commits