aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotgne22021-02-09 21:41:53 -0700
committernotgne22021-02-09 21:41:53 -0700
commitb8e28372500a0a5b14f501b63329a976462a0cc6 (patch)
treeee2d0c457615ecfdf74e678480b5b1ef8e5fefc8 /src
parentfecc7e723db40c7e056371467275186b3bbb9ef3 (diff)
Clean up adding Command arguments
Diffstat (limited to 'src')
-rw-r--r--src/bin/deploy.rs14
-rw-r--r--src/deploy.rs14
-rw-r--r--src/push.rs20
3 files changed, 23 insertions, 25 deletions
diff --git a/src/bin/deploy.rs b/src/bin/deploy.rs
index 8bd8b18..756c97c 100644
--- a/src/bin/deploy.rs
+++ b/src/bin/deploy.rs
@@ -107,26 +107,24 @@ async fn check_deployment(
) -> Result<(), CheckDeploymentError> {
info!("Running checks for flake in {}", repo);
- let mut c = match supports_flakes {
+ let mut check_command = match supports_flakes {
true => Command::new("nix"),
false => Command::new("nix-build"),
};
- let mut check_command = match supports_flakes {
+ match supports_flakes {
true => {
- c.arg("flake")
- .arg("check")
- .arg(repo)
+ check_command.arg("flake").arg("check").arg(repo);
}
false => {
- c.arg("-E")
+ check_command.arg("-E")
.arg("--no-out-link")
- .arg(format!("let r = import {}/.; x = (if builtins.isFunction r then (r {{}}) else r); in if x ? checks then x.checks.${{builtins.currentSystem}} else {{}}", repo))
+ .arg(format!("let r = import {}/.; x = (if builtins.isFunction r then (r {{}}) else r); in if x ? checks then x.checks.${{builtins.currentSystem}} else {{}}", repo));
}
};
for extra_arg in extra_build_args {
- check_command = check_command.arg(extra_arg);
+ check_command.arg(extra_arg);
}
let check_status = check_command.status().await?;
diff --git a/src/deploy.rs b/src/deploy.rs
index 54d5ea7..fb6ce0a 100644
--- a/src/deploy.rs
+++ b/src/deploy.rs
@@ -153,11 +153,11 @@ pub async fn confirm_profile(
hostname: &str,
temp_path: Cow<'_, str>,
) -> Result<(), ConfirmProfileError> {
- let mut c = Command::new("ssh");
- let mut ssh_confirm_command = c.arg(format!("ssh://{}@{}", deploy_defs.ssh_user, hostname));
+ let mut ssh_confirm_command = Command::new("ssh");
+ ssh_confirm_command.arg(format!("ssh://{}@{}", deploy_defs.ssh_user, hostname));
for ssh_opt in &deploy_data.merged_settings.ssh_opts {
- ssh_confirm_command = ssh_confirm_command.arg(ssh_opt);
+ ssh_confirm_command.arg(ssh_opt);
}
let lock_path = super::make_lock_path(&temp_path, &deploy_data.profile.profile_settings.path);
@@ -248,8 +248,8 @@ pub async fn deploy_profile(
let ssh_addr = format!("ssh://{}@{}", deploy_defs.ssh_user, hostname);
- let mut ssh_activate_command_ = Command::new("ssh");
- let ssh_activate_command = ssh_activate_command_.arg(&ssh_addr);
+ let mut ssh_activate_command = Command::new("ssh");
+ ssh_activate_command.arg(&ssh_addr);
for ssh_opt in &deploy_data.merged_settings.ssh_opts {
ssh_activate_command.arg(&ssh_opt);
@@ -286,8 +286,8 @@ pub async fn deploy_profile(
info!("Creating activation waiter");
- let mut ssh_wait_command_ = Command::new("ssh");
- let ssh_wait_command = ssh_wait_command_.arg(&ssh_addr);
+ let mut ssh_wait_command = Command::new("ssh");
+ ssh_wait_command.arg(&ssh_addr);
for ssh_opt in &deploy_data.merged_settings.ssh_opts {
ssh_wait_command.arg(ssh_opt);
diff --git a/src/push.rs b/src/push.rs
index 0963a9a..4879372 100644
--- a/src/push.rs
+++ b/src/push.rs
@@ -49,25 +49,25 @@ pub async fn push_profile(data: PushProfileData<'_>) -> Result<(), PushProfileEr
data.deploy_data.profile_name, data.deploy_data.node_name
);
- let mut build_c = if data.supports_flakes {
+ let mut build_command = if data.supports_flakes {
Command::new("nix")
} else {
Command::new("nix-build")
};
- let mut build_command = if data.supports_flakes {
- build_c.arg("build").arg(format!(
+ if data.supports_flakes {
+ build_command.arg("build").arg(format!(
"{}#deploy.nodes.\"{}\".profiles.\"{}\".path",
data.repo, data.deploy_data.node_name, data.deploy_data.profile_name
))
} else {
- build_c.arg(&data.repo).arg("-A").arg(format!(
+ build_command.arg(&data.repo).arg("-A").arg(format!(
"deploy.nodes.\"{}\".profiles.\"{}\".path",
data.deploy_data.node_name, data.deploy_data.profile_name
))
};
- build_command = match (data.keep_result, data.supports_flakes) {
+ match (data.keep_result, data.supports_flakes) {
(true, _) => {
let result_path = data.result_path.unwrap_or("./.deploy-gc");
@@ -81,7 +81,7 @@ pub async fn push_profile(data: PushProfileData<'_>) -> Result<(), PushProfileEr
};
for extra_arg in data.extra_build_args {
- build_command = build_command.arg(extra_arg);
+ build_command.arg(extra_arg);
}
let build_exit_status = build_command
@@ -147,15 +147,15 @@ pub async fn push_profile(data: PushProfileData<'_>) -> Result<(), PushProfileEr
data.deploy_data.profile_name, data.deploy_data.node_name
);
- let mut copy_command_ = Command::new("nix");
- let mut copy_command = copy_command_.arg("copy");
+ let mut copy_command = Command::new("nix");
+ copy_command.arg("copy");
if data.deploy_data.merged_settings.fast_connection != Some(true) {
- copy_command = copy_command.arg("--substitute-on-destination");
+ copy_command.arg("--substitute-on-destination");
}
if !data.check_sigs {
- copy_command = copy_command.arg("--no-check-sigs");
+ copy_command.arg("--no-check-sigs");
}
let ssh_opts_str = data