This commit is contained in:
parent
05cf6cf9da
commit
f235867600
10 changed files with 110 additions and 4 deletions
|
@ -36,6 +36,9 @@ root_password = "root"
|
||||||
# Enable Bluetooth
|
# Enable Bluetooth
|
||||||
bluetooth = true
|
bluetooth = true
|
||||||
|
|
||||||
|
# GPU Video Drivers
|
||||||
|
gpu_driver = "NVIDIA"
|
||||||
|
|
||||||
[pkg]
|
[pkg]
|
||||||
# Additional packages
|
# Additional packages
|
||||||
pkg = [
|
pkg = [
|
||||||
|
|
|
@ -36,6 +36,9 @@ root_password = "root"
|
||||||
# Enable Bluetooth
|
# Enable Bluetooth
|
||||||
bluetooth = true
|
bluetooth = true
|
||||||
|
|
||||||
|
# GPU Video Drivers
|
||||||
|
gpu_driver = "NVIDIA"
|
||||||
|
|
||||||
[pkg]
|
[pkg]
|
||||||
# Additional packages
|
# Additional packages
|
||||||
pkg = [
|
pkg = [
|
||||||
|
|
|
@ -87,6 +87,15 @@ pub struct GeneralConfig {
|
||||||
pub root_password: Option<String>,
|
pub root_password: Option<String>,
|
||||||
// Enable Bluetooth
|
// Enable Bluetooth
|
||||||
pub bluetooth: Option<bool>,
|
pub bluetooth: Option<bool>,
|
||||||
|
/// Install Video Driver
|
||||||
|
pub gpu_driver: Option<GPUVendor>
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
|
pub enum GPUVendor {
|
||||||
|
AMD,
|
||||||
|
NVIDIA,
|
||||||
|
INTEL
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
|
|
24
src/install/firmware.rs
Normal file
24
src/install/firmware.rs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
use crate::{linux::systemd_service_enable, pkg::install_pkgs, print_status};
|
||||||
|
|
||||||
|
pub fn setup_fwupd() {
|
||||||
|
print_status("Enabling firmware updates");
|
||||||
|
install_pkgs(&["fwupd"]);
|
||||||
|
systemd_service_enable("fwupd-refresh.timer");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn setup_microcode() {
|
||||||
|
print_status("Installing CPU Microcode");
|
||||||
|
let cpuinfo = std::fs::read_to_string("/proc/cpuinfo").unwrap();
|
||||||
|
|
||||||
|
for line in cpuinfo.lines() {
|
||||||
|
if line.starts_with("vendor_id") {
|
||||||
|
if line.contains("GenuineIntel") {
|
||||||
|
install_pkgs(&["intel-ucode"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if line.contains("AuthenticAMD") {
|
||||||
|
install_pkgs(&["amd-ucode"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::GeneralConfig,
|
config::GeneralConfig,
|
||||||
linux::{arch_chroot, run_command, systemd_service_enable},
|
linux::{arch_chroot, install_file, run_command, systemd_service_enable},
|
||||||
print_status,
|
print_status,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ pub fn first_boot_values(conf: &GeneralConfig) {
|
||||||
print_status("Writing /etc/hostname");
|
print_status("Writing /etc/hostname");
|
||||||
std::fs::write("/mnt/etc/hostname", format!("{}\n", conf.hostname)).unwrap();
|
std::fs::write("/mnt/etc/hostname", format!("{}\n", conf.hostname)).unwrap();
|
||||||
|
|
||||||
|
install_file("/mnt/etc/hosts", &format!("127.0.0.1 localhost\n::1 localhost\n127.0.1.1 {}\n", conf.hostname), 0o644);
|
||||||
|
|
||||||
// LOCALE
|
// LOCALE
|
||||||
print_status("Setting locale");
|
print_status("Setting locale");
|
||||||
uncomment_first_value_of(&conf.locale, "/mnt/etc/locale.gen");
|
uncomment_first_value_of(&conf.locale, "/mnt/etc/locale.gen");
|
||||||
|
|
15
src/install/gpu.rs
Normal file
15
src/install/gpu.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
use crate::{config::GPUVendor, pkg::install_pkgs};
|
||||||
|
|
||||||
|
pub fn setup_video_drivers(vendor: &GPUVendor) {
|
||||||
|
match vendor {
|
||||||
|
GPUVendor::AMD => {
|
||||||
|
install_pkgs(&["xf86-video-amdgpu", "mesa", "lib32-mesa", "vulkan-radeon", "lib32-vulkan-radeon"]);
|
||||||
|
},
|
||||||
|
GPUVendor::NVIDIA => {
|
||||||
|
install_pkgs(&["nvidia", "nvidia-utils", "lib32-nvidia-utils"]);
|
||||||
|
},
|
||||||
|
GPUVendor::INTEL => {
|
||||||
|
install_pkgs(&["xf86-video-intel2", "mesa", "lib32-mesa", "vulkan-intel", "lib32-vulkan-intel"]);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
// TODO : Autojoin docker swarm
|
// TODO : Autojoin docker swarm
|
||||||
// TODO : Autojoin teleport
|
// TODO : Autojoin teleport
|
||||||
|
// TODO : Firewall
|
||||||
|
|
||||||
// DRIVE SELECTION
|
// DRIVE SELECTION
|
||||||
|
|
||||||
|
@ -8,7 +9,9 @@ use boot::setup_bootloader;
|
||||||
use desktop::setup_desktop;
|
use desktop::setup_desktop;
|
||||||
use docker::setup_docker;
|
use docker::setup_docker;
|
||||||
use drives::{format_drives, mount_drives};
|
use drives::{format_drives, mount_drives};
|
||||||
|
use firmware::{setup_fwupd, setup_microcode};
|
||||||
use first_boot::{first_boot_values, genfstab};
|
use first_boot::{first_boot_values, genfstab};
|
||||||
|
use gpu::setup_video_drivers;
|
||||||
use kernel::setup_mkinitcpio;
|
use kernel::setup_mkinitcpio;
|
||||||
use navos::setup_navos;
|
use navos::setup_navos;
|
||||||
use ollama::setup_ollama;
|
use ollama::setup_ollama;
|
||||||
|
@ -16,7 +19,7 @@ use security::{setup_secure_boot, setup_tpm_unlock};
|
||||||
use skel::setup_skel;
|
use skel::setup_skel;
|
||||||
use ssh::setup_ssh;
|
use ssh::setup_ssh;
|
||||||
use user::setup_users;
|
use user::setup_users;
|
||||||
use virt::setup_virtualization;
|
use virt::{setup_virtualization, setup_vm};
|
||||||
use yansi::{Color, Paint};
|
use yansi::{Color, Paint};
|
||||||
use zram::setup_zram;
|
use zram::setup_zram;
|
||||||
|
|
||||||
|
@ -35,6 +38,8 @@ pub mod ssh;
|
||||||
pub mod user;
|
pub mod user;
|
||||||
pub mod virt;
|
pub mod virt;
|
||||||
pub mod zram;
|
pub mod zram;
|
||||||
|
pub mod firmware;
|
||||||
|
pub mod gpu;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::InstallConfig,
|
config::InstallConfig,
|
||||||
|
@ -137,6 +142,12 @@ pub fn install(conf: InstallConfig) {
|
||||||
setup_bluetooth();
|
setup_bluetooth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setup_vm();
|
||||||
|
if let Some(gpu_vendor) = &conf.general.gpu_driver {
|
||||||
|
setup_video_drivers(gpu_vendor);
|
||||||
|
}
|
||||||
|
setup_fwupd();
|
||||||
|
setup_microcode();
|
||||||
setup_mkinitcpio(&conf.drive);
|
setup_mkinitcpio(&conf.drive);
|
||||||
setup_secure_boot();
|
setup_secure_boot();
|
||||||
|
|
||||||
|
|
|
@ -29,3 +29,7 @@ pub fn setup_virtualization(conf: &InstallConfig) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn setup_vm() {
|
||||||
|
// TODO : Install guest tools if in virt with systemd-detect-virt
|
||||||
|
}
|
||||||
|
|
32
src/pkg.rs
32
src/pkg.rs
|
@ -3,7 +3,31 @@ use crate::{
|
||||||
linux::{arch_chroot, run_command},
|
linux::{arch_chroot, run_command},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const DESKTOP_PKG: [&str; 5] = ["plasma", "sddm", "konsole", "dolphin", "navos/navos"];
|
pub const DESKTOP_PKG: [&str; 16] = [
|
||||||
|
// Desktop
|
||||||
|
"plasma",
|
||||||
|
"sddm",
|
||||||
|
|
||||||
|
// Sound
|
||||||
|
"pipewire",
|
||||||
|
"pipewire-alsa",
|
||||||
|
"pipewire-pulse",
|
||||||
|
"pipewire-jack",
|
||||||
|
"wireplumber",
|
||||||
|
|
||||||
|
// Applications
|
||||||
|
"konsole",
|
||||||
|
"dolphin",
|
||||||
|
"ffmpegthumbs",
|
||||||
|
"kate",
|
||||||
|
"okular",
|
||||||
|
"gwenview",
|
||||||
|
"ark",
|
||||||
|
"flatpak",
|
||||||
|
|
||||||
|
// Misc
|
||||||
|
"navos/navos"
|
||||||
|
];
|
||||||
|
|
||||||
pub const SERVER_PKG: [&str; 2] = ["tmux", "navos/navos"];
|
pub const SERVER_PKG: [&str; 2] = ["tmux", "navos/navos"];
|
||||||
|
|
||||||
|
@ -32,7 +56,11 @@ pub fn pacstrap(conf: &PackageConfig) {
|
||||||
"git",
|
"git",
|
||||||
"networkmanager",
|
"networkmanager",
|
||||||
"nano",
|
"nano",
|
||||||
"doas",
|
"openssh",
|
||||||
|
"zsh",
|
||||||
|
"zsh-completions",
|
||||||
|
"zsh-autosuggestions",
|
||||||
|
"man"
|
||||||
];
|
];
|
||||||
|
|
||||||
cmd.extend(
|
cmd.extend(
|
||||||
|
|
|
@ -63,6 +63,13 @@ pub fn print_config(conf: &InstallConfig) {
|
||||||
if conf.general.bluetooth.unwrap_or_default() {
|
if conf.general.bluetooth.unwrap_or_default() {
|
||||||
general_info.add_str(format!("🌀 Bluetooth {}", "✔️".paint(Color::Green)));
|
general_info.add_str(format!("🌀 Bluetooth {}", "✔️".paint(Color::Green)));
|
||||||
}
|
}
|
||||||
|
if let Some(vendor) = &conf.general.gpu_driver {
|
||||||
|
match vendor {
|
||||||
|
crate::config::GPUVendor::AMD => general_info.add_str(format!("🟥 AMD GPU {}", "✔️".paint(Color::Green))),
|
||||||
|
crate::config::GPUVendor::INTEL => general_info.add_str(format!("🟦 Intel GPU {}", "✔️".paint(Color::Green))),
|
||||||
|
crate::config::GPUVendor::NVIDIA => general_info.add_str(format!("🟩 NVIDIA GPU {}", "✔️".paint(Color::Green))),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
root_info.add_tree("🔨 General", general_info);
|
root_info.add_tree("🔨 General", general_info);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue