includeos / IncludeOS

A minimal, resource efficient unikernel for cloud services
https://includeos.github.io/
Apache License 2.0
4.93k stars 365 forks source link

Make it easier to write nix files that depend on IncludeOS #2284

Closed MagnusS closed 2 months ago

MagnusS commented 2 months ago

(This PR depends on https://github.com/includeos/vmrunner/pull/37, which removes the requirement for INCLUDEOS_VMRUNNER and INCLUDEOS_CHAINLOADER from vmrunner.)

An IncludeOS service can now be built with a very minimal nix derivation (see updated example.nix).

bonus:

alfreb commented 2 months ago

Awesome!

nix-build example.nix builds and runs and finishes 🤩

Running phase: checkPhase
Looking for chainloader: 
Found /nix/store/l5nbgsdprxg79fpn5j71yrx1fp26qfgj-chainloader-static-i686-unknown-linux-musl-dev/bin/chainloader Type:  /nix/store/l5nbgsdprxg79fpn5j71yrx1fp26qfgj-chainloader-static-i686-unknown-linux-musl-dev/bin/chainloader: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped

SeaBIOS (version rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org)

...

[ Machine ] Reserving 1048576 b for machine use
================================================================================

                           #include<os> // Literally

================================================================================
     [ Kernel ] Stack: 0x1ffb98
     [ Kernel ] Boot magic: 0x2badb002, addr: 0x9500
     [ x86_64 ] Initializing paging
                * Supported page sizes: 4.000_KiB, 2.000_MiB
                * Adding 512 1GiB entries @ 0x0 -> 0x8000000000
                * Identity mapping 0 -> 0, size 16.000_GiB, flags 0x83 (8192 pages á 2.000_MiB)
                * Marking page 0 as not present
                * Allowing execute on 0x201000 -> 0x2dda70
                * Passing page tables to CPU