Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 78 lines 2.1 kB view raw
1{ lib, stdenv, fetchurl, dosfstools, libseccomp, makeWrapper, mtools, parted 2, pkg-config, qemu, syslinux, util-linux }: 3 4let 5 version = "0.8.0"; 6 # list of all theoretically available targets 7 targets = [ 8 "genode" 9 "hvt" 10 "muen" 11 "spt" 12 "virtio" 13 "xen" 14 ]; 15in stdenv.mkDerivation { 16 pname = "solo5"; 17 inherit version; 18 19 nativeBuildInputs = [ makeWrapper pkg-config ]; 20 buildInputs = lib.optional (stdenv.hostPlatform.isLinux) libseccomp; 21 22 src = fetchurl { 23 url = "https://github.com/Solo5/solo5/releases/download/v${version}/solo5-v${version}.tar.gz"; 24 sha256 = "sha256-t80VOZ8Tr1Dq+mJfRPVLGqYprCaqegcQtDqdoHaSXW0="; 25 }; 26 27 hardeningEnable = [ "pie" ]; 28 29 configurePhase = '' 30 runHook preConfigure 31 sh configure.sh --prefix=/ 32 runHook postConfigure 33 ''; 34 35 enableParallelBuilding = true; 36 37 separateDebugInfo = true; 38 # debugging requires information for both the unikernel and the tender 39 40 installPhase = '' 41 runHook preInstall 42 export DESTDIR=$out 43 export PREFIX=$out 44 make install 45 46 substituteInPlace $out/bin/solo5-virtio-mkimage \ 47 --replace "/usr/lib/syslinux" "${syslinux}/share/syslinux" \ 48 --replace "/usr/share/syslinux" "${syslinux}/share/syslinux" \ 49 --replace "cp " "cp --no-preserve=mode " 50 51 wrapProgram $out/bin/solo5-virtio-mkimage \ 52 --prefix PATH : ${lib.makeBinPath [ dosfstools mtools parted syslinux ]} 53 54 runHook postInstall 55 ''; 56 57 doCheck = stdenv.hostPlatform.isLinux; 58 nativeCheckInputs = [ util-linux qemu ]; 59 checkPhase = '' 60 runHook preCheck 61 patchShebangs tests 62 ./tests/bats-core/bats ./tests/tests.bats 63 runHook postCheck 64 ''; 65 66 meta = with lib; { 67 description = "Sandboxed execution environment"; 68 homepage = "https://github.com/solo5/solo5"; 69 license = licenses.isc; 70 maintainers = [ maintainers.ehmry ]; 71 platforms = builtins.map ({arch, os}: "${arch}-${os}") 72 (cartesianProductOfSets { 73 arch = [ "aarch64" "x86_64" ]; 74 os = [ "freebsd" "genode" "linux" "openbsd" ]; 75 }); 76 }; 77 78}