mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-19 17:39:34 +00:00
runc: migrate to using buildGoPackage
This means `runc` becomes a multi-output derivation : `runc.bin` and `runc.man`. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
25eb8419d9
commit
e5277cf829
|
@ -1,9 +1,9 @@
|
||||||
{ stdenv, lib, fetchFromGitHub, removeReferencesTo, go-md2man
|
{ stdenv, lib, fetchFromGitHub, buildGoPackage, go-md2man
|
||||||
, go, pkgconfig, libapparmor, apparmor-parser, libseccomp }:
|
, pkgconfig, libapparmor, apparmor-parser, libseccomp, which }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
buildGoPackage rec {
|
||||||
name = "runc-${version}";
|
name = "runc-${version}";
|
||||||
version = "1.0.0-rc6";
|
version = "1.0.0-rc6";
|
||||||
|
|
||||||
|
@ -14,32 +14,26 @@ stdenv.mkDerivation rec {
|
||||||
sha256 = "1jwacb8xnmx5fr86gximhbl9dlbdwj3rpf27hav9q1si86w5pb1j";
|
sha256 = "1jwacb8xnmx5fr86gximhbl9dlbdwj3rpf27hav9q1si86w5pb1j";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = [ "out" "man" ];
|
goPackagePath = "github.com/opencontainers/runc";
|
||||||
|
outputs = [ "bin" "out" "man" ];
|
||||||
|
|
||||||
hardeningDisable = ["fortify"];
|
hardeningDisable = ["fortify"];
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig ];
|
nativeBuildInputs = [ pkgconfig ];
|
||||||
buildInputs = [ removeReferencesTo go-md2man go libseccomp libapparmor apparmor-parser ];
|
buildInputs = [ go-md2man libseccomp libapparmor apparmor-parser which ];
|
||||||
|
|
||||||
makeFlags = ''BUILDTAGS+=seccomp BUILDTAGS+=apparmor'';
|
makeFlags = ''BUILDTAGS+=seccomp BUILDTAGS+=apparmor'';
|
||||||
|
|
||||||
preConfigure = ''
|
buildPhase = ''
|
||||||
# Extract the source
|
cd go/src/${goPackagePath}
|
||||||
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
|
|
||||||
'';
|
|
||||||
|
|
||||||
preBuild = ''
|
|
||||||
cd go/src/github.com/opencontainers/runc
|
|
||||||
patchShebangs .
|
patchShebangs .
|
||||||
substituteInPlace libcontainer/apparmor/apparmor.go \
|
substituteInPlace libcontainer/apparmor/apparmor.go \
|
||||||
--replace /sbin/apparmor_parser ${apparmor-parser}/bin/apparmor_parser
|
--replace /sbin/apparmor_parser ${apparmor-parser}/bin/apparmor_parser
|
||||||
|
make ${makeFlags} runc
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
install -Dm755 runc $out/bin/runc
|
install -Dm755 runc $bin/bin/runc
|
||||||
|
|
||||||
# Include contributed man pages
|
# Include contributed man pages
|
||||||
man/md2man-all.sh -q
|
man/md2man-all.sh -q
|
||||||
|
@ -55,10 +49,6 @@ stdenv.mkDerivation rec {
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preFixup = ''
|
|
||||||
find $out/bin -type f -exec remove-references-to -t ${go} '{}' +
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = https://runc.io/;
|
homepage = https://runc.io/;
|
||||||
description = "A CLI tool for spawning and running containers according to the OCI specification";
|
description = "A CLI tool for spawning and running containers according to the OCI specification";
|
||||||
|
|
Loading…
Reference in a new issue