diff --git a/core/src/system.rs b/core/src/system.rs index ea843d3..03247a0 100644 --- a/core/src/system.rs +++ b/core/src/system.rs @@ -14,7 +14,7 @@ pub fn get_package_manager(data: &mut Data) -> Option { } for package_manager in &[ - "apt", "dnf", "emerge", "nix", "pacman", "yum", + "apt", "dnf", "emerge", "guix", "nix", "pacman", "yum", // "zypper", ] { if data.executables.iter().any(|exe| exe == package_manager) { @@ -99,6 +99,24 @@ pub fn get_packages( Some(packages) } } + "guix" => { + let result = command_output( + shell, + &format!("{} locate {}", package_manager, executable), + ); + if result.is_empty() { + return None; + } + let packages: Vec = result + .lines() + .map(|line| line.split_whitespace().next().unwrap().to_string()) + .collect(); + if packages.is_empty() { + None + } else { + Some(packages) + } + } "nix" => { if !data.executables.contains(&"nix-locate".to_string()) { eprintln!( @@ -183,6 +201,7 @@ pub fn install_package(data: &mut Data, package_manager: &str, package: &str) -> format!("{} install {}", package_manager, package) } "emerge" => format!("emerge {}", package), + "guix" => format!("guix package -i {}", package), "nix" => format!("nix profile install nixpkgs#{}", package), "pacman" => format!("pacman -S {}", package), _ => match package_manager.ends_with("command-not-found") { @@ -201,10 +220,10 @@ pub fn install_package(data: &mut Data, package_manager: &str, package: &str) -> }, }; - // nix does not require privilege escalation + // guix and nix do not require privilege escalation #[allow(clippy::single_match)] match package_manager { - "nix" => {} + "guix" | "nix" => {} _ => elevate(data, &mut install), }