use hardware requirements to display conflicts and prevent install (#2700)

* use hardware requirements to display conflicts and prevent install

* better messaging and also consider OS compatibility

* wip: backend hw requirements

* update backend components

* migration

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
Matt Hill
2024-10-29 13:48:03 -06:00
committed by GitHub
parent e1a91a7e53
commit 1be9cdae67
35 changed files with 725 additions and 500 deletions

View File

@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type DeviceFilter = {
class: "processor" | "display"
pattern: string
patternDescription: string
}

View File

@@ -1,7 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { DeviceFilter } from "./DeviceFilter"
export type HardwareRequirements = {
device: { display?: string; processor?: string }
device: Array<DeviceFilter>
ram: number | null
arch: string[] | null
}

View File

@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { LshwDisplay } from "./LshwDisplay"
import type { LshwProcessor } from "./LshwProcessor"
export type LshwDevice =
| ({ class: "processor" } & LshwProcessor)
| ({ class: "display" } & LshwDisplay)

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type LshwDisplay = { product: string }

View File

@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type LshwProcessor = { product: string }

View File

@@ -1,6 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Governor } from "./Governor"
import type { IpInfo } from "./IpInfo"
import type { LshwDevice } from "./LshwDevice"
import type { ServerStatus } from "./ServerStatus"
import type { SmtpValue } from "./SmtpValue"
import type { WifiInfo } from "./WifiInfo"
@@ -11,7 +12,7 @@ export type ServerInfo = {
id: string
hostname: string
version: string
versionCompat: string
packageVersionCompat: string
postInitMigrationTodos: string[]
lastBackup: string | null
lanAddress: string
@@ -31,4 +32,6 @@ export type ServerInfo = {
zram: boolean
governor: Governor | null
smtp: SmtpValue | null
ram: number
devices: Array<LshwDevice>
}

View File

@@ -62,6 +62,7 @@ export { DependencyRequirement } from "./DependencyRequirement"
export { DepInfo } from "./DepInfo"
export { Description } from "./Description"
export { DestroySubcontainerFsParams } from "./DestroySubcontainerFsParams"
export { DeviceFilter } from "./DeviceFilter"
export { Duration } from "./Duration"
export { EchoParams } from "./EchoParams"
export { EncryptedWire } from "./EncryptedWire"
@@ -111,6 +112,9 @@ export { LanInfo } from "./LanInfo"
export { ListServiceInterfacesParams } from "./ListServiceInterfacesParams"
export { ListVersionSignersParams } from "./ListVersionSignersParams"
export { LoginParams } from "./LoginParams"
export { LshwDevice } from "./LshwDevice"
export { LshwDisplay } from "./LshwDisplay"
export { LshwProcessor } from "./LshwProcessor"
export { MainStatus } from "./MainStatus"
export { Manifest } from "./Manifest"
export { MaybeUtf8String } from "./MaybeUtf8String"

View File

@@ -144,7 +144,7 @@ export type SDKManifest = {
* ```
*/
readonly hardwareRequirements?: {
readonly device?: { display?: RegExp; processor?: RegExp }
readonly device?: T.DeviceFilter[]
readonly ram?: number | null
readonly arch?: string[] | null
}