navos
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
JMARyA 2024-12-29 10:26:04 +01:00
parent 94ec42ea74
commit db1acbbd3c
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
6 changed files with 77 additions and 13 deletions

View file

@ -12,4 +12,3 @@ steps:
from_secret: pacco_token from_secret: pacco_token
KEY: KEY:
from_secret: navos_key from_secret: navos_key

13
navos.gpg Normal file
View file

@ -0,0 +1,13 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEZ25LdhYJKwYBBAHaRw8BAQdAKfDibdpsmNUlEqHZeBcrijo0e19AE/UZm9TO
KBDI4BW0F25hdk9TIDxuYXZvc0BoeWRyYXIuZGU+iJkEExYKAEEWIQR3jZ1+W2rD
diu1VB/uRG7HScSuAAUCZ25LdgIbAwUJC0jDugULCQgHAgIiAgYVCgkICwIEFgID
AQIeBwIXgAAKCRDuRG7HScSuAD/OAQDCf8wSe29h+HsscbGj2jarJxmEZwGYqG1h
S73gM+QXXgEAiIj71hakOq8z5AmBjFGN6L0LsVje7lWu97nld/yG7A24OARnbkt2
EgorBgEEAZdVAQUBAQdAxJImv/loUr0URHbRxFA142ls8J+zni193A7Lj3GPuWUD
AQgHiH4EGBYKACYWIQR3jZ1+W2rDdiu1VB/uRG7HScSuAAUCZ25LdgIbDAUJC0jD
ugAKCRDuRG7HScSuAPUeAQDzQC5VARZj1/1mnciKjZFqvjYTkbdHK9W8M8gWjB5d
uQD/Q/hjYHBZYOEPW5Ta7XxVvYdahG/vQ/z+Xsw1naK1Bw0=
=WT5+
-----END PGP PUBLIC KEY BLOCK-----

View file

@ -14,13 +14,13 @@ pub struct InstallConfig {
/// SSH Configuration /// SSH Configuration
pub ssh: Option<SSHConfig>, pub ssh: Option<SSHConfig>,
/// Ollama AI Config /// Ollama AI Config
pub ai: Option<OllamaConfig> pub ai: Option<OllamaConfig>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct OllamaConfig { pub struct OllamaConfig {
pub models: Option<Vec<String>>, pub models: Option<Vec<String>>,
pub gpu: bool pub gpu: bool,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]

View file

@ -10,6 +10,7 @@ use boot::setup_bootloader;
use drives::{format_drives, mount_drives}; use drives::{format_drives, mount_drives};
use first_boot::{first_boot_values, genfstab}; use first_boot::{first_boot_values, genfstab};
use kernel::setup_mkinitcpio; use kernel::setup_mkinitcpio;
use navos::setup_navos;
use ollama::setup_ollama; use ollama::setup_ollama;
use security::{setup_secure_boot, setup_tpm_unlock}; use security::{setup_secure_boot, setup_tpm_unlock};
use ssh::setup_ssh; use ssh::setup_ssh;
@ -21,11 +22,12 @@ pub mod boot;
pub mod drives; pub mod drives;
pub mod first_boot; pub mod first_boot;
pub mod kernel; pub mod kernel;
pub mod navos;
pub mod ollama;
pub mod security; pub mod security;
pub mod ssh; pub mod ssh;
pub mod user; pub mod user;
pub mod zram; pub mod zram;
pub mod ollama;
use crate::{ use crate::{
config::InstallConfig, config::InstallConfig,
@ -96,6 +98,7 @@ pub fn install(conf: InstallConfig) {
match conf.general.mode { match conf.general.mode {
crate::config::InstallMode::Base => {} crate::config::InstallMode::Base => {}
crate::config::InstallMode::Desktop => { crate::config::InstallMode::Desktop => {
setup_navos();
install_pkgs(&pkg::DESKTOP_PKG); install_pkgs(&pkg::DESKTOP_PKG);
print_status("Enable SDDM"); print_status("Enable SDDM");
std::os::unix::fs::symlink( std::os::unix::fs::symlink(
@ -105,6 +108,7 @@ pub fn install(conf: InstallConfig) {
.unwrap(); .unwrap();
} }
crate::config::InstallMode::Server => { crate::config::InstallMode::Server => {
setup_navos();
install_pkgs(&pkg::SERVER_PKG); install_pkgs(&pkg::SERVER_PKG);
} }
crate::config::InstallMode::Kiosk => { crate::config::InstallMode::Kiosk => {

45
src/install/navos.rs Normal file
View file

@ -0,0 +1,45 @@
use crate::{print_status, run_command};
use super::str_vec;
pub fn setup_navos() {
// pacman.conf
print_status("Copying pacman.conf");
std::fs::copy("/etc/pacman.conf", "/mnt/etc/pacman.conf").unwrap();
// import keys
print_status("Importing pkg keys");
std::fs::write(
"/mnt/usr/share/pacman/keyrings/navos.gpg",
include_str!("../../navos.gpg"),
)
.unwrap();
run_command(
&str_vec(vec![
"arch-chroot",
"/mnt",
"pacman-key",
"--add",
"/usr/share/pacman/keyrings/navos.gpg",
]),
None,
false,
);
run_command(
&str_vec(vec![
"arch-chroot",
"/mnt",
"pacman-key",
"--lsign-key",
"778D9D7E5B6AC3762BB5541FEE446EC749C4AE00",
]),
None,
false,
);
// remote os-release
print_status("Removing os-release");
std::fs::remove_file("/mnt/etc/os-release").unwrap();
}

View file

@ -2,7 +2,6 @@ use crate::{config::OllamaConfig, pkg::install_pkgs, run_command};
use super::str_vec; use super::str_vec;
pub fn setup_ollama(conf: &OllamaConfig) { pub fn setup_ollama(conf: &OllamaConfig) {
if conf.gpu { if conf.gpu {
install_pkgs(&["ollama-cuda"]); install_pkgs(&["ollama-cuda"]);
@ -10,13 +9,17 @@ pub fn setup_ollama(conf: &OllamaConfig) {
install_pkgs(&["ollama"]); install_pkgs(&["ollama"]);
} }
run_command(&str_vec(vec![ run_command(
&str_vec(vec![
"arch-chroot", "arch-chroot",
"/mnt", "/mnt",
"systemctl", "systemctl",
"enable", "enable",
"ollama.service" "ollama.service",
]), None, false); ]),
None,
false,
);
for model in conf.models.clone().unwrap_or_default() { for model in conf.models.clone().unwrap_or_default() {
// TODO : Pull models // TODO : Pull models