2021-01-24 12:17:26 +01:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config, libseccomp, util-linux, qemu }:
|
2020-10-08 16:20:39 +02:00
|
|
|
|
2021-03-18 00:13:43 +01:00
|
|
|
let
|
|
|
|
version = "0.6.8";
|
|
|
|
# list of all theoretically available targets
|
|
|
|
targets = [
|
|
|
|
"genode"
|
|
|
|
"hvt"
|
|
|
|
"muen"
|
|
|
|
"spt"
|
|
|
|
"virtio"
|
|
|
|
"xen"
|
|
|
|
];
|
2020-10-08 16:20:39 +02:00
|
|
|
in stdenv.mkDerivation {
|
|
|
|
pname = "solo5";
|
|
|
|
inherit version;
|
|
|
|
|
2021-01-19 07:50:56 +01:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-10-08 16:20:39 +02:00
|
|
|
buildInputs = lib.optional (stdenv.hostPlatform.isLinux) libseccomp;
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url =
|
|
|
|
"https://github.com/Solo5/solo5/releases/download/v${version}/solo5-v${version}.tar.gz";
|
2021-02-06 20:20:57 +01:00
|
|
|
sha256 = "sha256-zrxNCXJIuEbtE3YNRK8Bxu2koHsQkcF+xItoIyhj9Uc=";
|
2020-10-08 16:20:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
hardeningEnable = [ "pie" ];
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
|
|
|
sh configure.sh
|
|
|
|
runHook postConfigure
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
export DESTDIR=$out
|
|
|
|
export PREFIX=$out
|
|
|
|
make install-tools
|
2021-03-18 00:13:43 +01:00
|
|
|
|
|
|
|
# get CONFIG_* vars from Makeconf which also parse in sh
|
|
|
|
grep '^CONFIG_' Makeconf > nix_tmp_targetconf
|
|
|
|
source nix_tmp_targetconf
|
|
|
|
# install opam / pkg-config files for all enabled targets
|
|
|
|
${lib.concatMapStrings (bind: ''
|
|
|
|
[ -n "$CONFIG_${lib.toUpper bind}" ] && make install-opam-${bind}
|
|
|
|
'') targets}
|
|
|
|
|
2020-10-08 16:20:39 +02:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2021-03-18 00:16:09 +01:00
|
|
|
doCheck = stdenv.hostPlatform.isLinux;
|
2021-01-24 12:17:26 +01:00
|
|
|
checkInputs = [ util-linux qemu ];
|
2021-03-18 00:16:09 +01:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
2020-10-08 16:20:39 +02:00
|
|
|
patchShebangs tests
|
|
|
|
./tests/bats-core/bats ./tests/tests.bats
|
2021-03-18 00:16:09 +01:00
|
|
|
runHook postCheck
|
|
|
|
'';
|
2020-10-08 16:20:39 +02:00
|
|
|
|
|
|
|
meta = with lib; {
|
2020-10-11 07:55:05 +02:00
|
|
|
description = "Sandboxed execution environment";
|
2020-10-08 16:20:39 +02:00
|
|
|
homepage = "https://github.com/solo5/solo5";
|
|
|
|
license = licenses.isc;
|
|
|
|
maintainers = [ maintainers.ehmry ];
|
2021-01-28 23:03:02 +01:00
|
|
|
platforms = builtins.map ({arch, os}: "${arch}-${os}")
|
|
|
|
(cartesianProductOfSets {
|
|
|
|
arch = [ "aarch64" "x86_64" ];
|
|
|
|
os = [ "freebsd" "genode" "linux" "openbsd" ];
|
|
|
|
});
|
2020-10-08 16:20:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|