nixpkgs/pkgs/applications/virtualization/runc/default.nix

60 lines
1.6 KiB
Nix
Raw Normal View History

{ stdenv, lib, fetchFromGitHub, buildGoPackage, go-md2man
, pkgconfig, libapparmor, apparmor-parser, libseccomp, which }:
2016-05-21 18:18:24 +02:00
with lib;
buildGoPackage rec {
2016-05-21 18:18:24 +02:00
name = "runc-${version}";
version = "1.0.0-rc7";
2016-05-21 18:18:24 +02:00
src = fetchFromGitHub {
owner = "opencontainers";
repo = "runc";
2017-01-11 09:32:26 +01:00
rev = "v${version}";
sha256 = "1baryjpka8wmzc6c66bir12i390ix3641a06j33shpsb683ws3fj";
2016-05-21 18:18:24 +02:00
};
goPackagePath = "github.com/opencontainers/runc";
outputs = [ "bin" "out" "man" ];
2016-05-21 18:18:24 +02:00
hardeningDisable = ["fortify"];
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ go-md2man libseccomp libapparmor apparmor-parser which ];
2016-05-21 18:18:24 +02:00
makeFlags = ''BUILDTAGS+=seccomp BUILDTAGS+=apparmor'';
buildPhase = ''
cd go/src/${goPackagePath}
2016-05-21 18:18:24 +02:00
patchShebangs .
substituteInPlace libcontainer/apparmor/apparmor.go \
--replace /sbin/apparmor_parser ${apparmor-parser}/bin/apparmor_parser
make ${makeFlags} runc
2016-05-21 18:18:24 +02:00
'';
installPhase = ''
install -Dm755 runc $bin/bin/runc
2016-05-21 18:18:24 +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
'';
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 vdemeester ];
2016-05-21 18:18:24 +02:00
platforms = platforms.linux;
};
}