diff --git a/src/args.rs b/src/args.rs index 83a17b9..9575d5b 100644 --- a/src/args.rs +++ b/src/args.rs @@ -56,6 +56,10 @@ pub enum Command { #[clap(name = "nix")] Nix, + /// Install flatpak and enable flathub + #[clap(name = "flatpak")] + Flatpak, + /// Read jade installation config #[clap(name = "config")] Config { diff --git a/src/functions/base.rs b/src/functions/base.rs index 7969f29..f46edd8 100755 --- a/src/functions/base.rs +++ b/src/functions/base.rs @@ -118,3 +118,10 @@ pub fn setup_timeshift() { pub fn install_homemgr() { install(vec!["nix"]); } + +pub fn install_flatpak() { + install(vec!["flatpak"]); + exec_eval( + exec_chroot("flatpak", vec![String::from("remote-add"), String::from("--if-not-exists"), String::from("flathub"), String::from("https://flathub.org/repo/flathub.flatpakrepo")]), + ) +} diff --git a/src/functions/desktops.rs b/src/functions/desktops.rs index 422c139..af92a70 100755 --- a/src/functions/desktops.rs +++ b/src/functions/desktops.rs @@ -14,7 +14,6 @@ pub fn install_desktop_setup(desktop_setup: DesktopSetup) { DesktopSetup::Xfce => install_xfce(), DesktopSetup::Enlightenment => install_enlightenment(), DesktopSetup::None => log::debug!("No desktop setup selected"), - _ => crash("Unsupported desktop setup", 1), } install_networkmanager(); } diff --git a/src/internal/config.rs b/src/internal/config.rs index 137e101..611aa91 100755 --- a/src/internal/config.rs +++ b/src/internal/config.rs @@ -15,6 +15,7 @@ struct Config { rootpass: String, desktop: Option, timeshift: bool, + flatpak: bool, extra_packages: Vec, } @@ -144,6 +145,11 @@ pub fn read_config(configpath: PathBuf) { if config.timeshift { base::setup_timeshift(); } + println!(); + log::info!("Enabling flatpak : {}", config.flatpak); + if config.flatpak { + base::setup_flatpak(); + } log::info!("Extra packages : {:?}", config.extra_packages); let mut extra_packages: Vec<&str> = Vec::new(); for i in 0..config.extra_packages.len() { diff --git a/src/main.rs b/src/main.rs index 5fbd4c4..31afe01 100755 --- a/src/main.rs +++ b/src/main.rs @@ -55,6 +55,9 @@ fn main() { }, Command::Nix => { base::install_homemgr(); + }, + Command::Flatpak => { + base::install_flatpak(); } Command::Config { config } => { crate::internal::config::read_config(config);