Skip to content

Commit a802a29

Browse files
committed
chore: add sudo_file and sudo_password as cli options
1 parent c21f100 commit a802a29

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/cli.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ pub struct Opts {
111111
/// Prompt for sudo password during activation.
112112
#[arg(long)]
113113
interactive_sudo: Option<bool>,
114+
/// File for the sudo password with sops integration
115+
#[arg(long)]
116+
sudo_file: Option<PathBuf>,
117+
/// Key for the sudo password with sops integration
118+
#[arg(long)]
119+
sudo_secret: Option<String>,
114120
}
115121

116122
/// Returns if the available Nix installation supports flakes
@@ -812,7 +818,9 @@ pub async fn run(args: Option<&ArgMatches>) -> Result<(), RunError> {
812818
dry_activate: opts.dry_activate,
813819
remote_build: opts.remote_build,
814820
sudo: opts.sudo,
815-
interactive_sudo: opts.interactive_sudo
821+
interactive_sudo: opts.interactive_sudo,
822+
sudo_file: opts.sudo_file,
823+
sudo_secret: opts.sudo_secret,
816824
};
817825

818826
let supports_flakes = test_flake_support().await.map_err(RunError::FlakeTest)?;

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ pub struct CmdOverrides {
166166
pub activation_timeout: Option<u16>,
167167
pub sudo: Option<String>,
168168
pub interactive_sudo: Option<bool>,
169+
pub sudo_file: Option<PathBuf>,
170+
pub sudo_secret: Option<String>,
169171
pub dry_activate: bool,
170172
pub remote_build: bool,
171173
}
@@ -499,6 +501,12 @@ pub fn make_deploy_data<'a, 's>(
499501
if let Some(interactive_sudo) = cmd_overrides.interactive_sudo {
500502
merged_settings.interactive_sudo = Some(interactive_sudo);
501503
}
504+
if let Some(ref sudo_file) = cmd_overrides.sudo_file {
505+
merged_settings.sudo_file = Some(sudo_file.to_owned());
506+
}
507+
if let Some(ref sudo_secret) = cmd_overrides.sudo_secret {
508+
merged_settings.sudo_secret = Some(sudo_secret.to_owned());
509+
}
502510

503511
DeployData {
504512
node_name,

0 commit comments

Comments
 (0)