Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a flag for building configuration with nix-output-monitor #239

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ pub struct Opts {
/// Which sudo command to use. Must accept at least two arguments: user name to execute commands as and the rest is the command to execute
#[clap(long)]
sudo: Option<String>,
/// Call nom (nix-output-monitor) when building the configuration.
#[clap(long)]
nom: bool,
}

/// Returns if the available Nix installation supports flakes
Expand Down Expand Up @@ -418,6 +421,7 @@ async fn run_deploy(
boot: bool,
log_dir: &Option<String>,
rollback_succeeded: bool,
use_nom: bool,
) -> Result<(), RunDeployError> {
let to_deploy: ToDeploy = deploy_flakes
.iter()
Expand Down Expand Up @@ -557,6 +561,7 @@ async fn run_deploy(
keep_result,
result_path,
extra_build_args,
use_nom,
},
)
};
Expand Down Expand Up @@ -690,6 +695,7 @@ pub async fn run(args: Option<&ArgMatches>) -> Result<(), RunError> {
opts.boot,
&opts.log_dir,
opts.rollback_succeeded.unwrap_or(true),
opts.nom,
)
.await?;

Expand Down
7 changes: 4 additions & 3 deletions src/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub struct PushProfileData<'a> {
pub keep_result: bool,
pub result_path: Option<&'a str>,
pub extra_build_args: &'a [String],
pub use_nom: bool,
}

pub async fn build_profile_locally(data: &PushProfileData<'_>, derivation_name: &str) -> Result<(), PushProfileError> {
Expand All @@ -66,9 +67,9 @@ pub async fn build_profile_locally(data: &PushProfileData<'_>, derivation_name:
);

let mut build_command = if data.supports_flakes {
Command::new("nix")
Command::new(if data.use_nom {"nom"} else {"nix"})
} else {
Command::new("nix-build")
Command::new(if data.use_nom {"nom-build"} else {"nix-build"})
};

if data.supports_flakes {
Expand Down Expand Up @@ -184,7 +185,7 @@ pub async fn build_profile_remotely(data: &PushProfileData<'_>, derivation_name:
a => return Err(PushProfileError::CopyExit(a)),
};

let mut build_command = Command::new("nix");
let mut build_command = Command::new(if data.use_nom {"nom"} else {"nix"});
build_command
.arg("build").arg(derivation_name)
.arg("--eval-store").arg("auto")
Expand Down