fixed microvm

This commit is contained in:
Snorre 2025-03-04 13:45:46 +01:00
parent 5a279d1106
commit f3c5706763
4 changed files with 28 additions and 10 deletions

View file

@ -50,8 +50,7 @@
inputs.agenix.nixosModules.default
inputs.home-manager.nixosModules.default
inputs.simple-nixos-mailserver.nixosModule
inputs.microvm.nixosModules.microvm
{microvm.hypervisor = "qemu";}
inputs.microvm.nixosModules.host
];
in {
server-vm = nixpkgs.lib.nixosSystem {

View file

@ -14,15 +14,27 @@ nixpkgs.lib.extend (
config,
}: {microvm, ...}: {
imports = [microvm.host];
microvm.hypervisor = "cloud-hypervisor";
microvm.vms.${name} = {
pkgs = import nixpkgs {inherit system;};
microvm.shares = [
{
tag = "ro-store";
source = "/nix/store";
mountPoint = "/nix/.ro-store";
}
];
inherit config;
# Host build-time reference to where the MicroVM NixOS is defined
# under nixosConfigurations
flake = self;
# Specify from where to let `microvm -u` update later on
updateFlake = "git+file:///etc/nixos";
};
# Mount host /nix/store for drastically reduced image size and evaluation time
microvm.vms.${name}.config.shares = [
{
source = "/nix/store";
mountPoint = "/nix/.ro-store";
tag = "ro-store";
proto = "virtiofs";
}
];
};
};
}

View file

@ -1,5 +1,4 @@
{...}:
{
{...}: {
networking.useDHCP = false;
networking.wakeOnLan.enable = true;

View file

@ -1,7 +1,15 @@
{pkgs, ...}: {
{
pkgs,
lib,
...
}: {
boot.zfs.devNodes = "/dev/disk/by-path";
environment.systemPackages = with pkgs; [
zfs
];
# Microvm be fucking shit up
# fileSystems."/nix/store".fsType = lib.mkForce "zfs";
# fileSystems."/nix/store".device = lib.mkForce "zroot/nix/store";
}