|
3 | 3 | # nix-shell --argstr buildpath . |
4 | 4 | buildpath ? "", |
5 | 5 |
|
6 | | - # The unikernel to build |
7 | | - unikernel ? "./example", |
8 | | - |
9 | 6 | # vmrunner path, for vmrunner development |
10 | 7 | vmrunner ? "", |
11 | 8 |
|
|
16 | 13 | smp ? false, |
17 | 14 |
|
18 | 15 | includeos ? import ./default.nix { inherit withCcache; inherit smp; } |
19 | | - |
20 | 16 | }: |
21 | 17 |
|
22 | 18 | includeos.pkgs.mkShell.override { inherit (includeos) stdenv; } rec { |
@@ -48,49 +44,44 @@ includeos.pkgs.mkShell.override { inherit (includeos) stdenv; } rec { |
48 | 44 | ]; |
49 | 45 |
|
50 | 46 | shellHook = '' |
| 47 | + cat <<-EOF |
| 48 | +================================== IncludeOS nix-shell ================================== |
| 49 | +Packages: |
| 50 | + IncludeOS: ${includeos} |
| 51 | + vmrunner: ${vmrunnerPkg} |
| 52 | + chainloader: ${includeos.chainloader} |
51 | 53 |
|
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 |
69 | | - 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 |
76 | | - echo -e "\nThe C++ compiler set to:" |
77 | | - echo $(which $CXX) |
78 | | - echo -e "\nIncludeOS package:" |
79 | | - echo ${includeos} |
80 | | - echo -e "\n---------------------- Network privileges ---------------------" |
81 | | - echo "The vmrunner for IncludeOS tests requires bridged networking for full functionality." |
82 | | - echo "The following commands requiring sudo privileges can be used to set this up:" |
83 | | - echo "1. the qemu-bridge-helper needs sudo to create a bridge. Can be enabled with:" |
84 | | - echo " sudo chmod u+s ${includeos.pkgs.qemu}/libexec/qemu-bridge-helper" |
85 | | - echo "2. bridge43 must exist. Can be set up with vmrunner's create_bridge.sh script:" |
86 | | - echo " ${vmrunnerPkg.create_bridge}" |
87 | | - echo "3. /etc/qemu/bridge.conf must contain this line:" |
88 | | - echo " allow bridge43" |
89 | | - echo "" |
90 | | - echo "Some tests require ping, which requires premissions to send raw packets. On some hosts" |
91 | | - echo "this is not enabled by default for iputils provided by nix. It can be enabled with:" |
92 | | - echo "4. sudo setcap cap_net_raw+ep ${includeos.pkgs.iputils}/bin/ping" |
93 | | - echo " " |
94 | | - echo |
| 54 | +Tooling: |
| 55 | + CXX $(command -v $CXX) |
| 56 | + cmake: $(command -v cmake) |
| 57 | + nasm: $(command -v nasm) |
| 58 | + qemu-system-x86: $(command -v qemu-system-x86_64) |
| 59 | + grub-mkrescue: $(command -v grub-mkrescue) |
| 60 | + xorriso: $(command -v xorriso) |
| 61 | + ping: $(command -v ping) |
| 62 | +
|
| 63 | +---------------------------------- Network privileges ---------------------------------- |
| 64 | +The vmrunner for IncludeOS tests requires bridged networking for full functionality. |
| 65 | +The following checklist can be used to set this up from the host: |
| 66 | +
|
| 67 | +1. The qemu-bridge-helper needs root escalation to manipulate bridges. You can provide this |
| 68 | + either through capabilities or through root execution. Pick one: |
| 69 | + sudo chmod u+s ${includeos.pkgs.qemu}/libexec/qemu-bridge-helper |
| 70 | + sudo setcap cap_net_admin+ep ${includeos.pkgs.qemu}/libexec/qemu-bridge-helper |
| 71 | +
|
| 72 | +2. bridge43 must exist. Can be set up with vmrunner's create_bridge.sh script (not as root): |
| 73 | + ${vmrunnerPkg.create_bridge} |
| 74 | +
|
| 75 | +3. /etc/qemu/bridge.conf must contain this line: |
| 76 | + allow bridge43 |
| 77 | + Also note that /etc/qemu needs specific permissions, so it might be easiest to install |
| 78 | + qemu on the host to generate these directories for you, despite not using its executable here. |
| 79 | +
|
| 80 | +4. Some tests also perform ICMP pings, which requires permissions to send raw packets. On some |
| 81 | + hosts this is not enabled by default for iputils provided by nix. |
| 82 | + It can be enabled with: |
| 83 | + sudo setcap cap_net_raw+ep ${includeos.pkgs.iputils}/bin/ping |
| 84 | +
|
| 85 | +EOF |
95 | 86 | ''; |
96 | 87 | } |
0 commit comments