mirror of
https://github.com/cirruslabs/tart.git
synced 2026-10-02 12:15:19 +02:00
46 lines
1.1 KiB
Swift
46 lines
1.1 KiB
Swift
import Virtualization
|
|
|
|
@available(macOS 13, *)
|
|
struct Linux: Platform {
|
|
func os() -> OS {
|
|
.linux
|
|
}
|
|
|
|
func bootLoader(nvramURL: URL) throws -> VZBootLoader {
|
|
let result = VZEFIBootLoader()
|
|
|
|
result.variableStore = VZEFIVariableStore(url: nvramURL)
|
|
|
|
return result
|
|
}
|
|
|
|
func platform(nvramURL: URL, needsNestedVirtualization: Bool) throws -> VZPlatformConfiguration {
|
|
let config = VZGenericPlatformConfiguration()
|
|
if #available(macOS 15, *) {
|
|
config.isNestedVirtualizationEnabled = needsNestedVirtualization
|
|
}
|
|
return config
|
|
}
|
|
|
|
func graphicsDevice(vmConfig: VMConfig) -> VZGraphicsDeviceConfiguration {
|
|
let result = VZVirtioGraphicsDeviceConfiguration()
|
|
|
|
result.scanouts = [
|
|
VZVirtioGraphicsScanoutConfiguration(
|
|
widthInPixels: vmConfig.display.width,
|
|
heightInPixels: vmConfig.display.height
|
|
)
|
|
]
|
|
|
|
return result
|
|
}
|
|
|
|
func keyboards() -> [VZKeyboardConfiguration] {
|
|
[VZUSBKeyboardConfiguration()]
|
|
}
|
|
|
|
func pointingDevices() -> [VZPointingDeviceConfiguration] {
|
|
[VZUSBScreenCoordinatePointingDeviceConfiguration()]
|
|
}
|
|
}
|