it works? maybe?

This commit is contained in:
Aaron Honeycutt 2025-04-11 07:50:04 -06:00
parent 92a1b02e02
commit 049771bbac
2 changed files with 31 additions and 7 deletions

3
.gitignore vendored
View file

@ -1,5 +1,8 @@
/target /target
# Main nix files
flake.nix flake.nix
configuration.nix configuration.nix
home.nix home.nix
# Extra nix files
garrus.nix garrus.nix
gnome.nix

View file

@ -20,12 +20,12 @@ fn format_drive(drive_name: &str) -> rsfdisk::Result<()> {
disk.partition_table_create(PartitionTableKind::GPT)?; disk.partition_table_create(PartitionTableKind::GPT)?;
let partition_type = PartitionKind::builder() let boot_type = PartitionKind::builder()
.guid(Guid::LinuxRootx86_64) .guid(Guid::EfiSystem)
.build()?; .build()?;
let boot = Partition::builder() let boot = Partition::builder()
.partition_type(partition_type.clone()) .partition_type(boot_type.clone())
.name("EFI") .name("EFI")
//Assuming 512 bytes per sector, 2_097_152 sectors <=> 1 GiB. //Assuming 512 bytes per sector, 2_097_152 sectors <=> 1 GiB.
.size_in_sectors(2_097_152) .size_in_sectors(2_097_152)
@ -33,8 +33,12 @@ fn format_drive(drive_name: &str) -> rsfdisk::Result<()> {
let _ = disk.partition_add(boot)?; let _ = disk.partition_add(boot)?;
let root_type = PartitionKind::builder()
.guid(Guid::LinuxRootx86_64)
.build()?;
let root = Partition::builder() let root = Partition::builder()
.partition_type(partition_type) .partition_type(root_type)
.name("Root") .name("Root")
// Flash drive testing // Flash drive testing
// .size_in_sectors(121_634_816) // .size_in_sectors(121_634_816)
@ -169,6 +173,22 @@ fn grab_home() {
} }
} }
fn grab_gnome(){
let mut gnome_config = Easy::new();
gnome_config.url("https://gitlab.com/ahoneybun/nix-configs/-/raw/main/desktops/gnome.nix").unwrap();
let mut config_file = File::create("gnome.nix").unwrap();
{
let mut transfer = gnome_config.transfer();
transfer.write_function(|data| {
config_file.write_all(data).unwrap();
Ok(data.len())
}).unwrap();
transfer.perform().unwrap();
}
}
fn main() { fn main() {
println!("--------------------------------------"); println!("--------------------------------------");
println!("| Welcome to the Nyxi Installer 2.0! |"); println!("| Welcome to the Nyxi Installer 2.0! |");
@ -217,16 +237,16 @@ fn main() {
grab_flake(); grab_flake();
grab_config(); grab_config();
grab_home(); grab_home();
grab_gnome();
let _nixos_gen_config = Command::new("nixos-generate-config") let _nixos_gen_config = Command::new("nixos-generate-config")
.arg("no-file-systems")
.arg("--root") .arg("--root")
.arg("/mnt") .arg("/mnt")
.output() .output()
.expect("Failed to execute command"); .expect("Failed to execute command");
// Copies the nix files to /mnt/etc/nixos/ // Copies the nix files to /mnt/etc/nixos/
let _nix_copy = Command::new("cp") let _nix_copy = Command::new("mv")
.arg("flake.nix") .arg("flake.nix")
.arg("configuration.nix") .arg("configuration.nix")
.arg("home.nix") .arg("home.nix")
@ -267,8 +287,9 @@ fn main() {
} }
// Copies the system nix files to /mnt/etc/nixos/ // Copies the system nix files to /mnt/etc/nixos/
let _nix_copy = Command::new("cp") let _garrus_nix_copy = Command::new("cp")
.arg("garrus.nix") .arg("garrus.nix")
.arg("gnome.nix")
.arg("/mnt/etc/nixos") .arg("/mnt/etc/nixos")
.output() .output()
.expect("Failed to copy nix files over"); .expect("Failed to copy nix files over");