nixpkgs-suyu/pkgs/applications/virtualization/docker/default.nix

105 lines
3.9 KiB
Nix
Raw Normal View History

2016-09-10 12:45:01 +02:00
{ stdenv, lib, fetchFromGitHub, makeWrapper, pkgconfig, go-md2man
, go, containerd, runc
, sqlite, iproute, bridge-utils, devicemapper, systemd
, btrfs-progs, iptables, e2fsprogs, xz, utillinux, xfsprogs
, procps
2015-11-16 16:17:32 +01:00
}:
2014-01-24 14:39:43 +01:00
2015-08-27 13:22:29 +02:00
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md
2016-09-10 12:45:01 +02:00
with lib;
2015-11-16 16:17:32 +01:00
2014-01-24 14:39:43 +01:00
stdenv.mkDerivation rec {
name = "docker-${version}";
2016-12-16 14:57:08 +01:00
version = "1.12.5";
2014-01-24 14:39:43 +01:00
2015-08-04 05:16:03 +02:00
src = fetchFromGitHub {
owner = "docker";
repo = "docker";
rev = "v${version}";
2016-12-16 14:57:08 +01:00
sha256 = "1hnxmh2j1vm8714f7jwjrslkqkd1ry25g5wq76aqlpsz5fh2kqb0";
2014-01-24 14:39:43 +01:00
};
2015-11-16 16:17:32 +01:00
buildInputs = [
2016-09-10 12:45:01 +02:00
makeWrapper pkgconfig go-md2man go
sqlite devicemapper btrfs-progs systemd
2015-11-16 16:17:32 +01:00
];
2014-01-24 14:39:43 +01:00
dontStrip = true;
2014-01-24 14:39:43 +01:00
2016-09-10 12:45:01 +02:00
DOCKER_BUILDTAGS = []
++ optional (systemd != null) [ "journald" ]
++ optional (btrfs-progs == null) "exclude_graphdriver_btrfs"
++ optional (devicemapper == null) "exclude_graphdriver_devicemapper";
2016-01-14 03:40:26 +01:00
2016-05-27 16:41:05 +02: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 14:39:43 +01:00
buildPhase = ''
2015-05-10 12:26:53 +02:00
patchShebangs .
export AUTO_GOPATH=1
2016-09-10 12:45:01 +02:00
export DOCKER_GITCOMMIT="23cf638"
2015-04-25 15:46:35 +02:00
./hack/make.sh dynbinary
2014-01-24 14:39:43 +01:00
'';
2016-09-10 12:45:01 +02:00
outputs = ["out" "man"];
extraPath = makeBinPath [ iproute iptables e2fsprogs xz xfsprogs procps utillinux ];
2014-01-24 14:39:43 +01:00
installPhase = ''
2016-09-10 12:45:01 +02: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
install -Dm755 ./bundles/${version}/dynbinary-daemon/docker-proxy-${version} $out/libexec/docker/docker-proxy
2015-11-16 16:17:32 +01:00
makeWrapper $out/libexec/docker/docker $out/bin/docker \
2016-09-10 12:45:01 +02: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
ln -s ${containerd}/bin/containerd $out/libexec/docker/docker-containerd
ln -s ${containerd}/bin/containerd-shim $out/libexec/docker/docker-containerd-shim
ln -s ${runc}/bin/runc $out/libexec/docker/docker-runc
2014-01-24 14:39:43 +01: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 22:36:03 +02:00
install -Dm644 ./contrib/completion/fish/docker.fish $out/share/fish/vendor_completions.d/docker.fish
2014-01-24 14:39:43 +01:00
install -Dm644 ./contrib/completion/zsh/_docker $out/share/zsh/site-functions/_docker
2016-09-10 12:45:01 +02: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 14:39:43 +01:00
'';
2016-09-10 12:45:01 +02:00
meta = {
2015-08-04 05:16:03 +02:00
homepage = http://www.docker.com/;
2014-01-24 14:39:43 +01:00
description = "An open source project to pack, ship and run any application as a lightweight container";
license = licenses.asl20;
maintainers = with maintainers; [ offline tailhook ];
2014-01-24 14:39:43 +01:00
platforms = platforms.linux;
};
}