2019-03-20 18:23:30 +00:00
|
|
|
{ stdenv, lib, autoreconfHook, acl, go, file, git, wget, gnupg, trousers, squashfsTools,
|
2016-04-23 19:33:21 +01:00
|
|
|
cpio, fetchurl, fetchFromGitHub, iptables, systemd, makeWrapper, glibc }:
|
2015-08-19 11:04:34 +01:00
|
|
|
|
2015-09-01 10:08:44 +01:00
|
|
|
let
|
2016-10-15 04:00:54 +01:00
|
|
|
# Always get the information from
|
2016-06-08 16:43:42 +01:00
|
|
|
# https://github.com/coreos/rkt/blob/v${VERSION}/stage1/usr_from_coreos/coreos-common.mk
|
2017-10-05 14:47:30 +01:00
|
|
|
coreosImageRelease = "1478.0.0";
|
|
|
|
coreosImageSystemdVersion = "233";
|
2015-11-17 11:44:32 +00:00
|
|
|
|
|
|
|
# TODO: track https://github.com/coreos/rkt/issues/1758 to allow "host" flavor.
|
2016-06-24 20:55:03 +01:00
|
|
|
stage1Flavours = [ "coreos" "fly" ];
|
2016-07-23 02:18:29 +01:00
|
|
|
stage1Dir = "lib/rkt/stage1-images";
|
2015-09-03 14:04:59 +01:00
|
|
|
|
2015-09-01 10:08:44 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
2018-04-18 01:41:08 +01:00
|
|
|
version = "1.30.0";
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "rkt";
|
|
|
|
BUILDDIR="build-${pname}-${version}";
|
2015-08-19 11:04:34 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2017-06-24 00:24:19 +01:00
|
|
|
owner = "coreos";
|
|
|
|
repo = "rkt";
|
|
|
|
rev = "v${version}";
|
2018-04-18 01:41:08 +01:00
|
|
|
sha256 = "0dqf83b7iin1np8k8k1m8i99ybga8vx932q7n2q64yghkw7p6i00";
|
2015-08-19 11:04:34 +01:00
|
|
|
};
|
|
|
|
|
2015-10-25 00:57:06 +01:00
|
|
|
stage1BaseImage = fetchurl {
|
2016-02-05 19:14:13 +00:00
|
|
|
url = "http://alpha.release.core-os.net/amd64-usr/${coreosImageRelease}/coreos_production_pxe_image.cpio.gz";
|
2017-10-05 14:47:30 +01:00
|
|
|
sha256 = "0s4qdkkfp0iirfnm5ds3b3hxq0249kvpygyhflma8z90ivkzk5wq";
|
2015-09-01 10:08:44 +01:00
|
|
|
};
|
2015-09-03 14:04:59 +01:00
|
|
|
|
2016-01-15 13:11:08 +00:00
|
|
|
buildInputs = [
|
2016-04-23 19:33:21 +01:00
|
|
|
glibc.out glibc.static
|
2019-03-20 18:23:30 +00:00
|
|
|
autoreconfHook go file git wget gnupg trousers squashfsTools cpio acl systemd
|
2016-01-15 13:11:08 +00:00
|
|
|
makeWrapper
|
|
|
|
];
|
2015-09-03 14:04:59 +01:00
|
|
|
|
2015-08-19 11:04:34 +01:00
|
|
|
preConfigure = ''
|
|
|
|
./autogen.sh
|
2015-10-25 00:57:06 +01:00
|
|
|
configureFlagsArray=(
|
2015-11-17 11:44:32 +00:00
|
|
|
--with-stage1-flavors=${builtins.concatStringsSep "," stage1Flavours}
|
|
|
|
${if lib.findFirst (p: p == "coreos") null stage1Flavours != null then "
|
2015-10-25 00:57:06 +01:00
|
|
|
--with-coreos-local-pxe-image-path=${stage1BaseImage}
|
|
|
|
--with-coreos-local-pxe-image-systemd-version=v${coreosImageSystemdVersion}
|
2015-11-17 11:44:32 +00:00
|
|
|
" else "" }
|
2016-07-23 02:18:29 +01:00
|
|
|
--with-stage1-default-location=$out/${stage1Dir}/stage1-${builtins.elemAt stage1Flavours 0}.aci
|
2015-10-25 00:57:06 +01:00
|
|
|
);
|
2015-08-19 11:04:34 +01:00
|
|
|
'';
|
|
|
|
|
2015-09-03 14:04:59 +01:00
|
|
|
preBuild = ''
|
2015-10-25 00:57:06 +01:00
|
|
|
export BUILDDIR
|
2019-02-28 01:46:32 +00:00
|
|
|
export GOCACHE="$TMPDIR/go-cache"
|
2015-09-03 14:04:59 +01:00
|
|
|
'';
|
|
|
|
|
2015-08-19 11:04:34 +01:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2016-07-19 08:31:52 +01:00
|
|
|
cp -Rv $BUILDDIR/target/bin/rkt $out/bin
|
|
|
|
|
|
|
|
mkdir -p $out/lib/rkt/stage1-images/
|
2016-07-23 02:18:29 +01:00
|
|
|
cp -Rv $BUILDDIR/target/bin/stage1-*.aci $out/${stage1Dir}/
|
2016-07-19 08:31:52 +01:00
|
|
|
|
2016-01-15 13:11:08 +00:00
|
|
|
wrapProgram $out/bin/rkt \
|
2017-12-26 08:08:49 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : "${systemd.lib}/lib:${acl.out}/lib" \
|
2016-01-15 13:11:08 +00:00
|
|
|
--prefix PATH : ${iptables}/bin
|
2015-08-19 11:04:34 +01:00
|
|
|
'';
|
2015-09-03 14:04:59 +01:00
|
|
|
|
2015-08-19 11:04:34 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A fast, composable, and secure App Container runtime for Linux";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/coreos/rkt";
|
2015-08-19 11:04:34 +01:00
|
|
|
license = licenses.asl20;
|
2015-10-25 00:57:06 +01:00
|
|
|
maintainers = with maintainers; [ ragge steveej ];
|
2015-08-26 17:55:22 +01:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2020-03-07 21:16:53 +00:00
|
|
|
knownVulnerabilities = [
|
|
|
|
"CVE-2019-10144: processes run with `rkt enter` are given all capabilities during stage 2"
|
|
|
|
"CVE-2019-10145: processes run with `rkt enter` do not have seccomp filtering during stage 2"
|
|
|
|
"CVE-2019-10147: processes run with `rkt enter` are not limited by cgroups during stage 2"
|
|
|
|
];
|
2015-08-19 11:04:34 +01:00
|
|
|
};
|
|
|
|
}
|