diff --git a/src/action/base/create_or_merge_nix_config.rs b/src/action/base/create_or_merge_nix_config.rs index 1729e71..75c4411 100644 --- a/src/action/base/create_or_merge_nix_config.rs +++ b/src/action/base/create_or_merge_nix_config.rs @@ -434,6 +434,10 @@ impl Action for CreateOrMergeNixConfig { e, )) })?; + temp_file + .sync_all() + .await + .map_err(|e| Self::error(ActionErrorKind::Sync(temp_file_path.clone(), e)))?; tokio::fs::rename(&temp_file_path, &path) .await .map_err(|e| { diff --git a/src/action/mod.rs b/src/action/mod.rs index 036d38e..4dec577 100644 --- a/src/action/mod.rs +++ b/src/action/mod.rs @@ -443,6 +443,8 @@ pub enum ActionErrorKind { Open(std::path::PathBuf, #[source] std::io::Error), #[error("Write path `{0}`")] Write(std::path::PathBuf, #[source] std::io::Error), + #[error("Sync path `{0}`")] + Sync(std::path::PathBuf, #[source] std::io::Error), #[error("Seek path `{0}`")] Seek(std::path::PathBuf, #[source] std::io::Error), #[error("Flushing `{0}`")] diff --git a/src/cli/arg/instrumentation.rs b/src/cli/arg/instrumentation.rs index 424334f..8d7bb31 100644 --- a/src/cli/arg/instrumentation.rs +++ b/src/cli/arg/instrumentation.rs @@ -27,7 +27,7 @@ impl std::fmt::Display for Logger { } } -#[derive(clap::Args, Debug)] +#[derive(clap::Args, Debug, Default)] pub struct Instrumentation { /// Enable debug logs, -vv for trace #[clap(short = 'v', env = "NIX_INSTALLER_VERBOSITY", long, action = clap::ArgAction::Count, global = true)]