nixpkgs/pkgs/os-specific/solo5/default.nix

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

78 lines
2 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, dosfstools, libseccomp, makeWrapper, mtools, parted
, pkg-config, qemu, syslinux, util-linux }:
2020-10-08 16:20:39 +02:00
let
2022-08-11 19:11:54 +02:00
version = "0.7.3";
# 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;
nativeBuildInputs = [ makeWrapper 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";
2022-08-11 19:11:54 +02:00
sha256 = "sha256-8LftT22XzmmWxgYez+BAHDX4HOyl5DrwrpuO2+bqqcY=";
2020-10-08 16:20:39 +02:00
};
patches = [ ./fix_paths.patch ./test_sleep.patch ];
2022-08-11 19:11:54 +02:00
2020-10-08 16:20:39 +02:00
hardeningEnable = [ "pie" ];
configurePhase = ''
runHook preConfigure
2022-08-11 19:11:54 +02:00
sh configure.sh --prefix=/
2020-10-08 16:20:39 +02:00
runHook postConfigure
'';
enableParallelBuilding = true;
installPhase = ''
runHook preInstall
export DESTDIR=$out
export PREFIX=$out
2022-08-11 19:11:54 +02: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 16:20:39 +02:00
runHook postInstall
'';
doCheck = stdenv.hostPlatform.isLinux;
2021-01-24 12:17:26 +01:00
checkInputs = [ util-linux qemu ];
checkPhase = ''
runHook preCheck
2020-10-08 16:20:39 +02:00
patchShebangs tests
./tests/bats-core/bats ./tests/tests.bats
runHook postCheck
'';
2020-10-08 16:20:39 +02:00
meta = with lib; {
description = "Sandboxed execution environment";
2020-10-08 16:20:39 +02:00
homepage = "https://github.com/solo5/solo5";
license = licenses.isc;
maintainers = [ maintainers.ehmry ];
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
};
}