added flag to disable nix

This commit is contained in:
TheHolyTachanka 2023-02-19 18:42:50 +02:00
parent 4a9a00a195
commit 1fb960c1c6

View File

@ -131,6 +131,7 @@ fn get_macchina_package_count(
/// return the amount of packages installed with a given linux package manager /// return the amount of packages installed with a given linux package manager
/// Return `0` if the package manager is not installed /// Return `0` if the package manager is not installed
fn packages(pkg_manager: &PackageManager, macchina_package_count: &[(String, usize)]) -> usize { fn packages(pkg_manager: &PackageManager, macchina_package_count: &[(String, usize)]) -> usize {
let args: Vec<String> = env::args().collect();
match pkg_manager { match pkg_manager {
// libmacchina has very fast implementations for most package managers, so we use them // libmacchina has very fast implementations for most package managers, so we use them
// where we can, otherwise we fall back to method used by dylans version of pfetch // where we can, otherwise we fall back to method used by dylans version of pfetch
@ -176,7 +177,7 @@ fn packages(pkg_manager: &PackageManager, macchina_package_count: &[(String, usi
} }
// TODO: nix -q is very slow // TODO: nix -q is very slow
PackageManager::Nix => { PackageManager::Nix => {
if check_if_command_exists("nix-store") { if check_if_command_exists("nix-store") || !args.contains(&"--no-nix".to_owned()) || !args.contains(&"-n".to_owned()) {
run_and_count_lines( run_and_count_lines(
"nix-store", "nix-store",
&["-q", "--requisites", "/run/current-system/sw"], &["-q", "--requisites", "/run/current-system/sw"],