nixpkgs/pkgs/by-name/so/solo5/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

80 lines
2.1 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, dosfstools, libseccomp, makeWrapper, mtools, parted
, pkg-config, qemu_test, syslinux, util-linux }:
2020-10-08 14:20:39 +00:00
let
2024-04-05 11:57:14 +00:00
version = "0.8.1";
# list of all theoretically available targets
targets = [
"genode"
"hvt"
"muen"
"spt"
"virtio"
"xen"
];
2020-10-08 14:20:39 +00:00
in stdenv.mkDerivation {
pname = "solo5";
inherit version;
nativeBuildInputs = [ makeWrapper pkg-config ];
2020-10-08 14:20:39 +00: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";
2024-04-05 11:57:14 +00:00
sha256 = "sha256-J1xcL/AdcLQ7Ph3TFwEaS9l4cWjDQsTaXTdBDcT7p6E=";
2020-10-08 14:20:39 +00:00
};
hardeningEnable = [ "pie" ];
configurePhase = ''
runHook preConfigure
2022-08-11 17:11:54 +00:00
sh configure.sh --prefix=/
2020-10-08 14:20:39 +00:00
runHook postConfigure
'';
enableParallelBuilding = true;
2022-12-15 23:27:51 +00:00
separateDebugInfo = true;
# debugging requires information for both the unikernel and the tender
2020-10-08 14:20:39 +00:00
installPhase = ''
runHook preInstall
export DESTDIR=$out
export PREFIX=$out
2022-08-11 17:11:54 +00:00
make install
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 14:20:39 +00:00
runHook postInstall
'';
doCheck = stdenv.hostPlatform.isLinux;
nativeCheckInputs = [ util-linux qemu_test ];
checkPhase = ''
runHook preCheck
2020-10-08 14:20:39 +00:00
patchShebangs tests
substituteInPlace scripts/virtio-run/solo5-virtio-run.sh \
--replace " -no-acpi" ""
2020-10-08 14:20:39 +00:00
./tests/bats-core/bats ./tests/tests.bats
runHook postCheck
'';
2020-10-08 14:20:39 +00:00
2024-04-15 17:17:53 +00:00
meta = with lib; {
description = "Sandboxed execution environment";
2020-10-08 14:20:39 +00:00
homepage = "https://github.com/solo5/solo5";
2024-04-15 17:17:53 +00:00
license = licenses.isc;
maintainers = [ maintainers.ehmry ];
platforms = mapCartesianProduct ({ arch, os }: "${arch}-${os}") {
arch = [ "aarch64" "x86_64" ];
os = [ "freebsd" "genode" "linux" "openbsd" ];
};
2020-10-08 14:20:39 +00:00
};
}