Add a qemu port of my bhyverc script for running virtual machines on Linux.

This commit is contained in:
Tom Alexander
2025-09-16 18:26:01 -04:00
parent 3b007f8bc5
commit 37abf58271
2 changed files with 411 additions and 0 deletions

View File

@@ -5,6 +5,41 @@
...
}:
let
qemurc =
(pkgs.writeScriptBin "qemurc" (
builtins.readFile (
pkgs.replaceVars ./files/qemurc.bash {
"OVMFfd" = "${pkgs.OVMF.fd}";
mount_root = "/vm";
zfs_root = "zroot/linux/nix/vm";
}
)
)).overrideAttrs
(old: {
buildCommand = ''
${old.buildCommand}
patchShebangs $out
'';
});
qemurc_wrapped =
(pkgs.writeScriptBin "qemurc" ''
#!/usr/bin/env bash
export "PATH=${
lib.makeBinPath [
pkgs.swtpm
pkgs.tmux
]
}:''${PATH}"
exec ${qemurc}/bin/qemurc "''${@}"
'').overrideAttrs
(old: {
buildCommand = ''
${old.buildCommand}
patchShebangs $out
'';
});
in
{
imports = [ ];
@@ -22,6 +57,7 @@
{
environment.systemPackages = with pkgs; [
qemu
qemurc_wrapped
];
}
]