Skip to main content

Crate tatara_vm

Crate tatara_vm 

Source
Expand description

§tatara-vm — Darwin-hosted Linux guests for tatara-os

Typed VmSpec authored in tatara-lisp, emitted as config for whichever hypervisor the host has available:

  • vfkit — Apple Virtualization.framework, minimal CLI, JSON config. Default on Darwin. Installed via nixpkgs’ vfkit attribute.
  • qemu — portable fallback; KVM on Linux, HVF on Darwin (intel).
  • kasou — pleme-io’s own Virtualization.framework wrapper. Used when we want Rust-native control, no CLI shell-out.

The Nix story: the VM’s kernel + initrd + rootfs are tatara Derivation values. That means every guest is content-addressed, and two identical VmSpec values produce the same bytes in /nix/store. Darwin hosts the hypervisor; Nix (on Darwin) builds every guest artifact.

Lisp authoring:

(defvm plex-guest
  :cpus     4
  :memory-mib 4096
  :hypervisor (:kind Vfkit)
  :kernel   (:bridge "linuxPackages.kernel")
  :initrd   (:bridge "tatara.initrd")
  :rootfs   (:system plex)
  :network  ((:kind Nat :subnet "10.200.0.0/24"))
  :shares   ((:host "/Users/drzzln/code" :guest "/mnt/code"))
  :cmdline  ("console=hvc0" "init=/bin/tatara-init"))

Re-exports§

pub use boot::compose;
pub use boot::BootManifest;
pub use config::GuestKernel;
pub use config::GuestRootfs;
pub use config::Hypervisor;
pub use config::NetworkKind;
pub use config::NetworkSpec;
pub use config::ShareSpec;
pub use config::VmSpec;
pub use darwin_rootfs::DarwinRootfs;
pub use engine::engine_for;
pub use engine::EngineSelectError;
pub use guest::GuestKind;
pub use guest::GuestSpec;
pub use guest::ResourceLimits;
pub use guest::WasmSpec;
pub use rootfs::GuestPackage;
pub use rootfs::InitrdContent;
pub use rootfs::InitrdFile;
pub use rootfs::LinuxRootfs;
pub use vfkit::VfkitEmitter;
pub use vfkit::VfkitJson;

Modules§

boot
Compose a tatara-os SystemConfig + a tatara-init binary path into a complete bootable VM manifest — kernel derivation + initrd derivation + VmSpec ready to hand to VfkitEmitter.
config
Typed VM definitions — the Lisp authoring surface.
darwin_rootfs
Native-arch Darwin guest support.
engine
Engine selection — map a (defvm …) Hypervisor to an in-process [maquina_engine::MaquinaEngine].
guest
GuestSpec — the superset of Linux-VM and WASM guests.
rootfs
Initrd builder — assembles tatara-init + config + kernel modules into a bootable cpio-gzip archive that Linux can use as its rootfs.
vfkit
vfkit config emitter.