110 lines
2.5 KiB
Rust
110 lines
2.5 KiB
Rust
use std::fmt::Display;
|
|
|
|
use serde::Deserialize;
|
|
|
|
/// Declarative install configuration
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct InstallConfig {
|
|
/// Drive Configuration
|
|
pub drive: DriveConfig,
|
|
/// General Configuration
|
|
pub general: GeneralConfig,
|
|
/// Package Configuration
|
|
pub pkg: PackageConfig,
|
|
/// User Configuration
|
|
pub user: Option<Vec<UserConfig>>,
|
|
/// SSH Configuration
|
|
pub ssh: Option<SSHConfig>,
|
|
/// Ollama AI Config
|
|
pub ai: Option<OllamaConfig>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct OllamaConfig {
|
|
pub models: Option<Vec<String>>,
|
|
pub gpu: bool,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct SSHConfig {
|
|
pub sshd_config: Option<String>,
|
|
pub key: Option<Vec<SSHKey>>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct SSHKey {
|
|
pub key: String,
|
|
pub users: Vec<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct UserConfig {
|
|
pub name: String,
|
|
pub password: String,
|
|
pub doas_root: Option<bool>,
|
|
pub docker: Option<bool>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct PackageConfig {
|
|
/// Packages to install
|
|
pub pkg: Vec<String>,
|
|
/// Enable libvirt
|
|
pub virtualization: Option<bool>,
|
|
/// Enable docker
|
|
pub docker: Option<bool>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct DriveConfig {
|
|
/// Boot Drive Path
|
|
pub boot: String,
|
|
/// Root Drive Path
|
|
pub root: String,
|
|
/// Enable encryption on root
|
|
pub encryption: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct GeneralConfig {
|
|
/// Presets
|
|
pub mode: InstallMode,
|
|
/// System locale
|
|
pub locale: String,
|
|
/// Keyboard Layout
|
|
pub keyboard_layout: String,
|
|
/// Keyboard Variant
|
|
pub keyboard_variant: Option<String>,
|
|
/// Timezone
|
|
pub timezone: String,
|
|
/// Hostname
|
|
pub hostname: String,
|
|
// Root password
|
|
pub root_password: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub enum InstallMode {
|
|
/// Basic Arch Linux Installation
|
|
Base,
|
|
/// navOS Desktop
|
|
Desktop,
|
|
/// navOS Server
|
|
Server,
|
|
|
|
// TODO : Evaluate
|
|
Kiosk,
|
|
}
|
|
|
|
impl Display for InstallMode {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
InstallMode::Base => f.write_str("Base")?,
|
|
InstallMode::Desktop => f.write_str("Desktop")?,
|
|
InstallMode::Server => f.write_str("Server")?,
|
|
InstallMode::Kiosk => f.write_str("Kiosk")?,
|
|
}
|
|
|
|
Ok(())
|
|
}
|
|
}
|