Merge pull request #2 from AlexanderMaxRanabel/master
Added NixOS Instructions + Fixed NixOS shell, will work on fixing distro name for some distros (e.g. NixOS)
This commit is contained in:
commit
10bd4bd6e2
2 changed files with 28 additions and 14 deletions
|
@ -18,6 +18,10 @@ sudo pacman -S rustup git figlet
|
|||
```bash
|
||||
sudo apt install rustup git figlet
|
||||
```
|
||||
- NixOS
|
||||
```bash
|
||||
sudo nix-env -iA nixos.rustup nixos.git nixos.figlet
|
||||
```
|
||||
If you don't want to install figlet (for the ASCII logo) then you can remove "figlet" from the end of both commands. I'm working on removing figlet from the dependency list alltogether, and packaging the logos in the program, however that would require a lot of testing (likely involving VMs).
|
||||
|
||||
## 2. Clone the repository:
|
||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -59,7 +59,7 @@ fn main() {
|
|||
// I know it's terrible, but it works.
|
||||
let mut kernel = String::new();
|
||||
{
|
||||
let kernel_file = File::open("/proc/version").expect("do u even linux bro???");
|
||||
let kernel_file = File::open("/proc/version").expect("Read the README.md you dumbass");
|
||||
let mut kernel_reader = BufReader::new(kernel_file);
|
||||
kernel_reader.read_line(&mut kernel).expect("Failed string conversion");
|
||||
}
|
||||
|
@ -135,9 +135,19 @@ fn main() {
|
|||
}
|
||||
|
||||
// Get shell
|
||||
let shell = env::var("SHELL").expect("Could not read $SHELL variable");
|
||||
println!("│ Shell: {}", Cyan.paint(shell));
|
||||
let shell_raw = env::var("SHELL").expect("Could not read $SHELL variable");
|
||||
|
||||
// Split the path using '/' as the separator
|
||||
// Thanks ChatGPT
|
||||
let parts: Vec<&str> = shell_raw.rsplitn(2, '/').collect();
|
||||
|
||||
// Check if the path contains at least one '/'
|
||||
if parts.len() > 1 {
|
||||
let shell = parts[0];
|
||||
println!("│ Shell: {}", Cyan.paint(shell));
|
||||
} else {
|
||||
println!("Invalid path format.");
|
||||
}
|
||||
// Time for a challenge, Get CPU model!
|
||||
{
|
||||
let file = File::open("/proc/cpuinfo").expect("Could not read /proc/cpuinfo");
|
||||
|
|
Loading…
Reference in a new issue