2022-02-05 18:45:11 +03:00
|
|
|
{ lib, stdenv, fetchurl, dosfstools, libseccomp, makeWrapper, mtools, parted
|
|
|
|
, pkg-config, qemu, syslinux, util-linux }:
|
2020-10-08 17:20:39 +03:00
|
|
|
|
2021-03-18 02:13:43 +03:00
|
|
|
let
|
2023-04-29 11:48:29 +03:00
|
|
|
version = "0.8.0";
|
2021-03-18 02:13:43 +03:00
|
|
|
# list of all theoretically available targets
|
|
|
|
targets = [
|
|
|
|
"genode"
|
|
|
|
"hvt"
|
|
|
|
"muen"
|
|
|
|
"spt"
|
|
|
|
"virtio"
|
|
|
|
"xen"
|
|
|
|
];
|
2020-10-08 17:20:39 +03:00
|
|
|
in stdenv.mkDerivation {
|
|
|
|
pname = "solo5";
|
|
|
|
inherit version;
|
|
|
|
|
2022-02-05 18:45:11 +03:00
|
|
|
nativeBuildInputs = [ makeWrapper pkg-config ];
|
2020-10-08 17:20:39 +03:00
|
|
|
buildInputs = lib.optional (stdenv.hostPlatform.isLinux) libseccomp;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-12-13 20:22:55 +03:00
|
|
|
url = "https://github.com/Solo5/solo5/releases/download/v${version}/solo5-v${version}.tar.gz";
|
2023-04-29 11:48:29 +03:00
|
|
|
sha256 = "sha256-t80VOZ8Tr1Dq+mJfRPVLGqYprCaqegcQtDqdoHaSXW0=";
|
2020-10-08 17:20:39 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
hardeningEnable = [ "pie" ];
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
2022-08-11 20:11:54 +03:00
|
|
|
sh configure.sh --prefix=/
|
2020-10-08 17:20:39 +03:00
|
|
|
runHook postConfigure
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-12-16 02:27:51 +03:00
|
|
|
separateDebugInfo = true;
|
|
|
|
# debugging requires information for both the unikernel and the tender
|
|
|
|
|
2020-10-08 17:20:39 +03:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
export DESTDIR=$out
|
|
|
|
export PREFIX=$out
|
2022-08-11 20:11:54 +03:00
|
|
|
make install
|
2021-03-18 02:13:43 +03:00
|
|
|
|
2022-02-05 18:45:11 +03:00
|
|
|
substituteInPlace $out/bin/solo5-virtio-mkimage \
|
|
|
|
--replace "/usr/lib/syslinux" "${syslinux}/share/syslinux" \
|
|
|
|
--replace "/usr/share/syslinux" "${syslinux}/share/syslinux" \
|
|
|
|
--replace "cp " "cp --no-preserve=mode "
|
|
|
|
|
|
|
|
wrapProgram $out/bin/solo5-virtio-mkimage \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ dosfstools mtools parted syslinux ]}
|
|
|
|
|
2020-10-08 17:20:39 +03:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2021-03-18 02:16:09 +03:00
|
|
|
doCheck = stdenv.hostPlatform.isLinux;
|
2023-01-21 15:00:00 +03:00
|
|
|
nativeCheckInputs = [ util-linux qemu ];
|
2021-03-18 02:16:09 +03:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
2020-10-08 17:20:39 +03:00
|
|
|
patchShebangs tests
|
|
|
|
./tests/bats-core/bats ./tests/tests.bats
|
2021-03-18 02:16:09 +03:00
|
|
|
runHook postCheck
|
|
|
|
'';
|
2020-10-08 17:20:39 +03:00
|
|
|
|
|
|
|
meta = with lib; {
|
2020-10-11 08:55:05 +03:00
|
|
|
description = "Sandboxed execution environment";
|
2020-10-08 17:20:39 +03:00
|
|
|
homepage = "https://github.com/solo5/solo5";
|
|
|
|
license = licenses.isc;
|
|
|
|
maintainers = [ maintainers.ehmry ];
|
2021-01-29 01:03:02 +03:00
|
|
|
platforms = builtins.map ({arch, os}: "${arch}-${os}")
|
|
|
|
(cartesianProductOfSets {
|
|
|
|
arch = [ "aarch64" "x86_64" ];
|
|
|
|
os = [ "freebsd" "genode" "linux" "openbsd" ];
|
|
|
|
});
|
2020-10-08 17:20:39 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|