mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-11 22:10:09 +01:00
fix(nix): use nix shell -c and improve nix-index usage
This commit is contained in:
parent
d9c5ff21cf
commit
e2bd052f85
1 changed files with 9 additions and 8 deletions
|
|
@ -139,7 +139,13 @@ pub fn get_packages(
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let result =
|
let result =
|
||||||
command_output(shell, &format!("nix-locate --regex 'bin/{}$'", executable));
|
command_output(
|
||||||
|
shell,
|
||||||
|
&format!(
|
||||||
|
"nix-locate --minimal --no-group --top-level --type x --type s --whole-name --at-root '/bin/{}'",
|
||||||
|
executable,
|
||||||
|
),
|
||||||
|
);
|
||||||
if result.is_empty() {
|
if result.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
@ -149,9 +155,7 @@ pub fn get_packages(
|
||||||
line.split_whitespace()
|
line.split_whitespace()
|
||||||
.next()
|
.next()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.rsplit_once('.')
|
.trim_end_matches(".out") // remove .out, keep the rest as is
|
||||||
.unwrap()
|
|
||||||
.0
|
|
||||||
.to_string()
|
.to_string()
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
@ -258,10 +262,7 @@ pub fn shell_package(data: &Data, package_manager: &str, package: &str) -> Strin
|
||||||
|
|
||||||
match package_manager {
|
match package_manager {
|
||||||
"guix" => format!("guix shell {} -- {}", package, command),
|
"guix" => format!("guix shell {} -- {}", package, command),
|
||||||
"nix" => format!(
|
"nix" => format!(r#"nix shell nixpkgs#{} -c {}"#, package, command),
|
||||||
r#"nix-shell -p {} --command "{};return""#,
|
|
||||||
package, command
|
|
||||||
),
|
|
||||||
_ => unreachable!("Only `nix` and `guix` are supported for shell installation"),
|
_ => unreachable!("Only `nix` and `guix` are supported for shell installation"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue