mirror of
https://gitlab.com/ahoneybun/nyxi-installer.git
synced 2025-05-12 11:04:02 -06:00
add Command for testing and testing for a flash drive
This commit is contained in:
parent
ea7303c2ee
commit
8ddbfe05d8
3 changed files with 139 additions and 4 deletions
101
Cargo.lock
generated
101
Cargo.lock
generated
|
@ -87,6 +87,36 @@ version = "0.8.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "curl"
|
||||||
|
version = "0.4.47"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d9fb4d13a1be2b58f14d60adba57c9834b78c62fd86c3e76a148f732686e9265"
|
||||||
|
dependencies = [
|
||||||
|
"curl-sys",
|
||||||
|
"libc",
|
||||||
|
"openssl-probe",
|
||||||
|
"openssl-sys",
|
||||||
|
"schannel",
|
||||||
|
"socket2",
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "curl-sys"
|
||||||
|
version = "0.4.80+curl-8.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "55f7df2eac63200c3ab25bde3b2268ef2ee56af3d238e76d61f01c3c49bff734"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"libc",
|
||||||
|
"libz-sys",
|
||||||
|
"openssl-sys",
|
||||||
|
"pkg-config",
|
||||||
|
"vcpkg",
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
version = "1.15.0"
|
version = "1.15.0"
|
||||||
|
@ -138,7 +168,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -159,7 +189,7 @@ version = "0.5.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf"
|
checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -210,6 +240,18 @@ dependencies = [
|
||||||
"windows-targets",
|
"windows-targets",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libz-sys"
|
||||||
|
version = "1.1.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
|
"vcpkg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.4.15"
|
version = "0.4.15"
|
||||||
|
@ -287,6 +329,7 @@ dependencies = [
|
||||||
name = "nyxi-installer"
|
name = "nyxi-installer"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"curl",
|
||||||
"rsfdisk",
|
"rsfdisk",
|
||||||
"sys_metrics",
|
"sys_metrics",
|
||||||
]
|
]
|
||||||
|
@ -297,6 +340,24 @@ version = "1.21.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc"
|
checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-probe"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-sys"
|
||||||
|
version = "0.9.107"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8288979acd84749c744a9014b4382d42b8f7b2592847b5afb2ed29e5d16ede07"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
|
"vcpkg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "peeking_take_while"
|
name = "peeking_take_while"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
|
@ -420,7 +481,16 @@ dependencies = [
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
"windows-sys",
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "schannel"
|
||||||
|
version = "0.1.27"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -449,6 +519,16 @@ version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "socket2"
|
||||||
|
version = "0.5.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.109"
|
version = "1.0.109"
|
||||||
|
@ -549,6 +629,12 @@ version = "1.0.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "vcpkg"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "which"
|
name = "which"
|
||||||
version = "4.4.2"
|
version = "4.4.2"
|
||||||
|
@ -561,6 +647,15 @@ dependencies = [
|
||||||
"rustix",
|
"rustix",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.52.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.59.0"
|
version = "0.59.0"
|
||||||
|
|
|
@ -4,5 +4,6 @@ version = "2.0.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
curl = "0.4.47"
|
||||||
rsfdisk = "0.1.0"
|
rsfdisk = "0.1.0"
|
||||||
sys_metrics = "0.2.7"
|
sys_metrics = "0.2.7"
|
||||||
|
|
41
src/main.rs
41
src/main.rs
|
@ -1,6 +1,7 @@
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::{stdout, Write};
|
use std::io::{stdout, Write};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
use std::process::Command;
|
||||||
use sys_metrics::disks;
|
use sys_metrics::disks;
|
||||||
use rsfdisk::fdisk::Fdisk;
|
use rsfdisk::fdisk::Fdisk;
|
||||||
use rsfdisk::core::partition_table::PartitionTableKind;
|
use rsfdisk::core::partition_table::PartitionTableKind;
|
||||||
|
@ -33,7 +34,10 @@ fn format_drive(drive_name: &str) -> rsfdisk::Result<()> {
|
||||||
let root = Partition::builder()
|
let root = Partition::builder()
|
||||||
.partition_type(partition_type)
|
.partition_type(partition_type)
|
||||||
.name("Root")
|
.name("Root")
|
||||||
.size_in_sectors(499_033_071_616)
|
// 132,120,576 sectors for a 64GB flash drive
|
||||||
|
.size_in_sectors(132_120_576)
|
||||||
|
// 500GB
|
||||||
|
//.size_in_sectors(499_033_071_61)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
let _ = disk.partition_add(root)?;
|
let _ = disk.partition_add(root)?;
|
||||||
|
@ -45,6 +49,29 @@ fn format_drive(drive_name: &str) -> rsfdisk::Result<()> {
|
||||||
|
|
||||||
fn mount_parts() {}
|
fn mount_parts() {}
|
||||||
|
|
||||||
|
// fn grab_configs() {
|
||||||
|
// let mut flakeConfig = Easy::new();
|
||||||
|
// let mut mainConfig = Easy::new();
|
||||||
|
// let mut homeConfig = Easy::new();
|
||||||
|
|
||||||
|
// flakeConfig.url("https://gitlab.com/ahoneybun/nix-configs/-/raw/main/flake.nix").unwrap();
|
||||||
|
// mainConfig.url("https://gitlab.com/ahoneybun/nix-configs/-/raw/main/configuration.nix").unwrap();
|
||||||
|
// homeConfig.url("https://gitlab.com/ahoneybun/nix-configs/-/raw/main/home.nix").unwrap();
|
||||||
|
|
||||||
|
// let mut flakeFile = File::create("flake.nix").unwrap();
|
||||||
|
// let mut mainFile = File::create("configuration.nix").unwrap();
|
||||||
|
// let mut homeFile = File::create("home.nix").unwrap();
|
||||||
|
|
||||||
|
// {
|
||||||
|
// let mut flakeTransfer = easy.transfer();
|
||||||
|
// transfer.write_function(|data| {
|
||||||
|
// flakeFile.write_all(data).unwrap();
|
||||||
|
// Ok(data.len())
|
||||||
|
// }).unwrap();
|
||||||
|
// transfer.perform().unwrap();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
fn grab_flake() {
|
fn grab_flake() {
|
||||||
let mut easy = Easy::new();
|
let mut easy = Easy::new();
|
||||||
easy.url("https://gitlab.com/ahoneybun/nix-configs/-/raw/main/flake.nix").unwrap();
|
easy.url("https://gitlab.com/ahoneybun/nix-configs/-/raw/main/flake.nix").unwrap();
|
||||||
|
@ -93,6 +120,15 @@ fn grab_home() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn nix_gen() {
|
||||||
|
let output = Command::new("nixos-generate-config")
|
||||||
|
.arg("no-file-systems")
|
||||||
|
.arg("--root")
|
||||||
|
.arg("/mnt")
|
||||||
|
.output()
|
||||||
|
.expect("Failed to execute command");
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("--------------------------------------");
|
println!("--------------------------------------");
|
||||||
println!("| Welcome to the Nyxi Installer 2.0! |");
|
println!("| Welcome to the Nyxi Installer 2.0! |");
|
||||||
|
@ -129,9 +165,12 @@ fn main() {
|
||||||
// Partitioning the selected drive
|
// Partitioning the selected drive
|
||||||
format_drive(drive_name);
|
format_drive(drive_name);
|
||||||
|
|
||||||
|
// placeholder for nix-generate-config
|
||||||
|
|
||||||
// Download nix files
|
// Download nix files
|
||||||
grab_flake();
|
grab_flake();
|
||||||
grab_config();
|
grab_config();
|
||||||
grab_home();
|
grab_home();
|
||||||
|
|
||||||
|
nix_gen();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue