File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- { withCcache ? false ,
1+ {
22
3- doCheck ? true , # boot unikernel after building it
4- includeos ? import ./default.nix { inherit withCcache ; } ,
3+ # The unikernel to build
4+ unikernel ? ./example ,
5+
6+ # Boot unikernel after building it
7+ doCheck ? true ,
8+
9+ # Enable multicore suport.
10+ smp ? false ,
11+
12+ # Enable ccache support. See overlay.nix for details.
13+ withCcache ? false ,
14+
15+ # The includeos library to build and link against
16+ includeos ? import ./default.nix { inherit withCcache ; inherit smp ; } ,
517} :
618
719includeos . stdenv . mkDerivation rec {
820 pname = "includeos_example" ;
9- src = includeos . pkgs . lib . cleanSource ./example ;
21+ src = includeos . pkgs . lib . cleanSource " ${ unikernel } " ;
1022 dontStrip = true ;
1123 inherit doCheck ;
1224
@@ -20,13 +32,22 @@ includeos.stdenv.mkDerivation rec {
2032 includeos . chainloader
2133 ] ;
2234
35+ cmakeFlags = [
36+ "-DARCH=x86_64"
37+ "-DINCLUDEOS_PACKAGE=${ includeos } "
38+ "-DCMAKE_MODULE_PATH=${ includeos } /cmake"
39+ "-DFOR_PRODUCTION=OFF"
40+ ] ;
41+
2342 nativeCheckInputs = [
2443 includeos . vmrunner
2544 includeos . pkgs . qemu
2645 ] ;
2746
2847 checkPhase = ''
48+ runHook preCheck
2949 boot *.elf.bin
50+ runHook postCheck
3051 '' ;
3152
3253 version = "dev" ;
Original file line number Diff line number Diff line change 33 # nix-shell --argstr buildpath .
44 buildpath ? "" ,
55
6- # The unikernel to build
7- unikernel ? "./example" ,
8-
96 # vmrunner path, for vmrunner development
107 vmrunner ? "" ,
118
1613 smp ? false ,
1714
1815 includeos ? import ./default.nix { inherit withCcache ; inherit smp ; }
19-
2016} :
2117
2218includeos . pkgs . mkShell . override { inherit ( includeos ) stdenv ; } rec {
@@ -48,31 +44,7 @@ includeos.pkgs.mkShell.override { inherit (includeos) stdenv; } rec {
4844 ] ;
4945
5046 shellHook = ''
51-
52- unikernel=$(realpath ${ unikernel } )
53- echo -e "Attempting to build unikernel: \n$unikernel"
54- if [ ! -d "$unikernel" ]; then
55- echo "$unikernel is not a valid directory"
56- exit 1
57- fi
58- export BUILDPATH=${ buildpath }
59- if [ -z "${ buildpath } " ]; then
60- export BUILDPATH="$(mktemp -d)"
61- pushd "$BUILDPATH"
62- else
63- mkdir -p "$BUILDPATH"
64- pushd "$BUILDPATH"
65- fi
66- cmake "$unikernel" -DARCH=x86_64 -DINCLUDEOS_PACKAGE=${ includeos } -DCMAKE_MODULE_PATH=${ includeos } /cmake \
67- -DFOR_PRODUCTION=OFF
68- make -j $NIX_BUILD_CORES
6947 echo -e "\n====================== IncludeOS nix-shell ====================="
70- if [ -z "${ buildpath } " ]; then
71- echo -e "\nWorking directory, generated by this script:"
72- echo $BUILDPATH
73- echo -e "\nTo use another directory pass in 'buildpath' to nix:"
74- echo "nix-shell --argstr buildpath you/build/path"
75- fi
7648 echo -e "\nThe C++ compiler set to:"
7749 echo $(which $CXX)
7850 echo -e "\nIncludeOS package:"
You can’t perform that action at this time.
0 commit comments