refactor: handle clippy lints
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
parent
cb34302e17
commit
85a6d6cc9a
2 changed files with 3 additions and 8 deletions
|
@ -6,7 +6,6 @@
|
||||||
use clap::{arg, command, crate_authors, value_parser, ArgAction, Command};
|
use clap::{arg, command, crate_authors, value_parser, ArgAction, Command};
|
||||||
|
|
||||||
const DEFAULT_CACHE: &str = "cache.nixos.org";
|
const DEFAULT_CACHE: &str = "cache.nixos.org";
|
||||||
const DEFAULT_INSTALLABLE: &str = "./#nixosConfigurations.{}.config.system.build.toplevel";
|
|
||||||
|
|
||||||
pub fn build_cli() -> Command {
|
pub fn build_cli() -> Command {
|
||||||
command!()
|
command!()
|
||||||
|
|
|
@ -29,11 +29,7 @@ fn get_config_drv_path(host: &str, config_dir: &str) -> std::io::Result<std::pro
|
||||||
|
|
||||||
/// Get installable derivation path
|
/// Get installable derivation path
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_installable_drv_path(
|
fn get_installable_drv_path(installable: &str) -> std::io::Result<std::process::Output> {
|
||||||
host: &str,
|
|
||||||
config_dir: &str,
|
|
||||||
installable: &str,
|
|
||||||
) -> std::io::Result<std::process::Output> {
|
|
||||||
Command::new("nix")
|
Command::new("nix")
|
||||||
.args(["build", "--quiet", installable, "--dry-run", "--json"])
|
.args(["build", "--quiet", installable, "--dry-run", "--json"])
|
||||||
.output()
|
.output()
|
||||||
|
@ -69,9 +65,9 @@ fn requisites_to_hashes(
|
||||||
pub fn get_requisites(host: &str, config_dir: &str, installable: Option<String>) -> String {
|
pub fn get_requisites(host: &str, config_dir: &str, installable: Option<String>) -> String {
|
||||||
// If the users specified an installable, we interpret that, instead of trying
|
// If the users specified an installable, we interpret that, instead of trying
|
||||||
// to guess their config location.
|
// to guess their config location.
|
||||||
let mut drv_path;
|
let drv_path;
|
||||||
if let Some(installable) = installable {
|
if let Some(installable) = installable {
|
||||||
drv_path = get_installable_drv_path(host, config_dir, &installable).unwrap();
|
drv_path = get_installable_drv_path(&installable).unwrap();
|
||||||
} else {
|
} else {
|
||||||
drv_path = get_config_drv_path(host, config_dir).unwrap();
|
drv_path = get_config_drv_path(host, config_dir).unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue