Skip to content

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

Merged
alfreb merged 4 commits intoincludeos:v0.16.0-releasefrom
MagnusS:nix-improvements
Sep 18, 2024
Merged

Make it easier to write nix files that depend on IncludeOS#2284
alfreb merged 4 commits intoincludeos:v0.16.0-releasefrom
MagnusS:nix-improvements

Conversation

@MagnusS
Copy link
Copy Markdown
Member

@MagnusS MagnusS commented Sep 16, 2024

(This PR depends on includeos/vmrunner#37, which removes the requirement for INCLUDEOS_VMRUNNER and INCLUDEOS_CHAINLOADER from vmrunner.)

  • Add vmrunner and chainloader to overlay passthru so they can be easily picked up by other packages
  • Add pkgs and pkgsStatic to overlay so other packages don't have to import nixpkgs/overlay unless they have to
  • Simplify shell.nix to use the new values from the overlay and remove unused environment variables
  • Simplify example.nix and add a test phase to boot the VM

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

bonus:

  • update chainloader to use find_package

This adds vmrunner and chainloader to the IncludeOS overlay to make it
easier to import them from the shell and unikernels.

Also adds pkgs and pkgsStatic as shortcuts to the pinned nixpkgs +
overlay. This allows some packages that don't require full direct access
to nixpkgs to avoid importing the overlay (such as shell.nix or
example.nix)
- add includeos to buildInputs to enable cmake find_package
- use includeos overlay pointers to chainloader and vmrunner, use
  includeos.pkgs
- remove now unused imports pkgs and nixpkgs
- remove INCLUDEOS_VMRUNNER and INCLUDEOS_CHAINLOADER as they are no
  longer needed by vmrunner
- inherit stdenv from overlay instead of setting CC/CXX manually
- bash: add quotes around unikernel and buildpath
@alfreb
Copy link
Copy Markdown
Contributor

alfreb commented Sep 18, 2024

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
                

@alfreb alfreb merged commit 84e3f1a into includeos:v0.16.0-release Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants