mirror of
https://gitlab.com/ahoneybun/nyxi-installer.git
synced 2025-05-12 02:54:03 -06:00
add VM option
This commit is contained in:
parent
c070fcac90
commit
6623555a0b
1 changed files with 38 additions and 2 deletions
40
src/main.rs
40
src/main.rs
|
@ -246,7 +246,8 @@ fn main() {
|
|||
println!("---------------");
|
||||
println!("");
|
||||
println!("1. Lemur Pro 13 (Garrus)");
|
||||
println!("2. Generic");
|
||||
println!("2. Virtual Machine");
|
||||
println!("3. Generic");
|
||||
println!("");
|
||||
|
||||
println!("Enter your host for installation:");
|
||||
|
@ -289,8 +290,43 @@ fn main() {
|
|||
println!("Exited with status {:?}", install_status);
|
||||
|
||||
break
|
||||
}
|
||||
},
|
||||
"2" => {
|
||||
let mut vm_config = Easy::new();
|
||||
vm_config.url("https://gitlab.com/ahoneybun/nix-configs/-/raw/main/hosts/x86_64/vm/configuration.nix").unwrap();
|
||||
|
||||
let mut config_file = File::create("vm.nix").unwrap();
|
||||
|
||||
{
|
||||
let mut transfer = vm_config.transfer();
|
||||
transfer.write_function(|data| {
|
||||
config_file.write_all(data).unwrap();
|
||||
Ok(data.len())
|
||||
}).unwrap();
|
||||
transfer.perform().unwrap();
|
||||
}
|
||||
|
||||
// Copies the system nix files to /mnt/etc/nixos/
|
||||
let _garrus_nix_copy = Command::new("mv")
|
||||
.args(["vm.nix", "/mnt/etc/nixos"])
|
||||
.output()
|
||||
.expect("Failed to copy nix files over");
|
||||
|
||||
let mut nixos_install = Command::new("nixos-install")
|
||||
.arg("--flake")
|
||||
.arg("/mnt/etc/nixos#vm")
|
||||
.arg("--no-root-passwd")
|
||||
.stdout(Stdio::inherit())
|
||||
.stderr(Stdio::inherit())
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
let install_status = nixos_install.wait();
|
||||
println!("Exited with status {:?}", install_status);
|
||||
|
||||
break;
|
||||
}
|
||||
"3" => {
|
||||
let mut nixos_install = Command::new("nixos-install")
|
||||
.arg("--flake")
|
||||
.arg("/mnt/etc/nixos#nixos")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue