Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

microvm underlying VM's kernel and packages configuration #152

Open
jkuro-tii opened this issue May 26, 2023 · 2 comments
Open

microvm underlying VM's kernel and packages configuration #152

jkuro-tii opened this issue May 26, 2023 · 2 comments

Comments

@jkuro-tii
Copy link
Contributor

The microvm component is used for running virtual machines inside Ghaf environment. It builds a kernel for virtual machines and filesystems. Filesystems contains NixOS components and additional needed by microvm during runtime (startup scripts, etc.).

Microvm's feature is that it contains hard-coded kernel and package set definitions: kernel configuration and VM's NixOS packages set. There is no way to define a custom packages configuration.
It means that we are unable to define a VM with our own kernel version, configuration, and applied patches. We also cannot change the default package set. I solved this issue in the PR#94, source.

After getting more familiar with Nix/NixOS mechanisms, I have a proposal of solving the problem other way.

Solution

The microvm component is added additional options:

  • microvm.vm.kernel: VM kernel package
  • microvm.vm.packages: VM NixOS packages to be included in the build

Example

microvm.vm.kernel = pkgs.linuxPackages_5_4.callPackage ./memsharevm-kernel.nix {};
microvm.vm.packages = pkgs.linuxPackages_5_4.extend (_: _: {
kernel = microvm.vm.kernel;
});

Sample kernel configuration: memsharevm-kernel.nix

I think that such change should be easily accepted by microvm's author. I already contacted him regarding other change.

@vilvo
Copy link
Contributor

vilvo commented May 26, 2023

There is related recent work in the microvm.nix upstream - see comment and context at astro/microvm.nix#82 (comment)

In general - yes, we need support for guest VMs with custom kernels and user spaces. Also, discussion with the microvm's author is very much appreciated.

@mikatammi
Copy link
Contributor

astro/microvm.nix#82

This was merged some time ago and our ghaf flake.lock is already using this.

I haven't tested yet, but it should be possible to use the regular boot.kernelPackages = ...; inside the microvm now

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

No branches or pull requests

3 participants