update + ollama
This commit is contained in:
parent
b3e38cde60
commit
16a965d56c
4 changed files with 40 additions and 0 deletions
|
@ -13,6 +13,14 @@ pub struct InstallConfig {
|
|||
pub user: Vec<UserConfig>,
|
||||
/// SSH Configuration
|
||||
pub ssh: Option<SSHConfig>,
|
||||
/// Ollama AI Config
|
||||
pub ai: Option<OllamaConfig>
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct OllamaConfig {
|
||||
pub models: Option<Vec<String>>,
|
||||
pub gpu: bool
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
|
|
@ -2,6 +2,8 @@ use crate::{config::DriveConfig, run_command};
|
|||
|
||||
use super::str_vec;
|
||||
|
||||
// TODO : Add support for using entire block device
|
||||
|
||||
pub fn format_drives(conf: &DriveConfig, encrypted: bool) {
|
||||
// EFI (BOOT)
|
||||
run_command(
|
||||
|
|
|
@ -10,6 +10,7 @@ use boot::setup_bootloader;
|
|||
use drives::{format_drives, mount_drives};
|
||||
use first_boot::{first_boot_values, genfstab};
|
||||
use kernel::setup_mkinitcpio;
|
||||
use ollama::setup_ollama;
|
||||
use security::{setup_secure_boot, setup_tpm_unlock};
|
||||
use ssh::setup_ssh;
|
||||
use user::setup_users;
|
||||
|
@ -24,6 +25,7 @@ pub mod security;
|
|||
pub mod ssh;
|
||||
pub mod user;
|
||||
pub mod zram;
|
||||
pub mod ollama;
|
||||
|
||||
use crate::{
|
||||
config::InstallConfig,
|
||||
|
@ -118,6 +120,10 @@ pub fn install(conf: InstallConfig) {
|
|||
// TODO : Enable docker
|
||||
}
|
||||
|
||||
if let Some(ai) = conf.ai {
|
||||
setup_ollama(&ai);
|
||||
}
|
||||
|
||||
setup_zram();
|
||||
setup_mkinitcpio(&conf.drive);
|
||||
setup_secure_boot();
|
||||
|
|
24
src/install/ollama.rs
Normal file
24
src/install/ollama.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
use crate::{config::OllamaConfig, pkg::install_pkgs, run_command};
|
||||
|
||||
use super::str_vec;
|
||||
|
||||
|
||||
pub fn setup_ollama(conf: &OllamaConfig) {
|
||||
if conf.gpu {
|
||||
install_pkgs(&["ollama-cuda"]);
|
||||
} else {
|
||||
install_pkgs(&["ollama"]);
|
||||
}
|
||||
|
||||
run_command(&str_vec(vec![
|
||||
"arch-chroot",
|
||||
"/mnt",
|
||||
"systemctl",
|
||||
"enable",
|
||||
"ollama.service"
|
||||
]), None, false);
|
||||
|
||||
for model in conf.models.clone().unwrap_or_default() {
|
||||
// TODO : Pull models
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue