File size: 372 Bytes
2d766b8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | use std::process::Command;
pub fn run_in_nix(cmd: &str, packages: Vec<&str>) -> String {
let pkgs = packages.join(" ");
let output = Command::new("nix-shell")
.arg("-p")
.arg(pkgs)
.arg("--run")
.arg(cmd)
.output()
.expect("failed to execute nix command");
String::from_utf8_lossy(&output.stdout).to_string()
} |