2017-03-11 14:08:09 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, fetchpatch, removeReferencesTo, go-md2man
|
2016-05-21 17:18:24 +01:00
|
|
|
, go, pkgconfig, libapparmor, apparmor-parser, libseccomp }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "runc-${version}";
|
2017-06-10 17:05:57 +01:00
|
|
|
version = "1.0.0-rc3";
|
2016-05-21 17:18:24 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "opencontainers";
|
|
|
|
repo = "runc";
|
2017-01-11 08:32:26 +00:00
|
|
|
rev = "v${version}";
|
2017-06-10 17:05:57 +01:00
|
|
|
sha256 = "14hdhnni0rz3g0bhcaq95zn2zrhyds0mq2pm2padbamg4bgq4r1c";
|
2016-05-21 17:18:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
|
|
|
hardeningDisable = ["fortify"];
|
|
|
|
|
2017-03-11 14:08:09 +00:00
|
|
|
buildInputs = [ removeReferencesTo go-md2man go pkgconfig libseccomp libapparmor apparmor-parser ];
|
2016-05-21 17:18:24 +01:00
|
|
|
|
|
|
|
makeFlags = ''BUILDTAGS+=seccomp BUILDTAGS+=apparmor'';
|
|
|
|
|
2017-06-10 17:05:57 +01:00
|
|
|
preConfigure = ''
|
|
|
|
# Extract the source
|
|
|
|
cd "$NIX_BUILD_TOP"
|
|
|
|
mkdir -p "go/src/github.com/opencontainers"
|
|
|
|
mv "$sourceRoot" "go/src/github.com/opencontainers/runc"
|
|
|
|
export GOPATH=$NIX_BUILD_TOP/go:$GOPATH
|
|
|
|
'';
|
|
|
|
|
2016-05-21 17:18:24 +01:00
|
|
|
preBuild = ''
|
2017-06-10 17:05:57 +01:00
|
|
|
cd go/src/github.com/opencontainers/runc
|
2016-05-21 17:18:24 +01:00
|
|
|
patchShebangs .
|
|
|
|
substituteInPlace libcontainer/apparmor/apparmor.go \
|
|
|
|
--replace /sbin/apparmor_parser ${apparmor-parser}/bin/apparmor_parser
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -Dm755 runc $out/bin/runc
|
|
|
|
|
|
|
|
# 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 = ''
|
2017-03-11 14:08:09 +00:00
|
|
|
find $out/bin -type f -exec remove-references-to -t ${go} '{}' +
|
2016-05-21 17:18:24 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = https://runc.io/;
|
|
|
|
description = "A CLI tool for spawning and running containers according to the OCI specification";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ offline ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|