From 0cc6693f00378117f51704ab7b11d2befa0cbf1f Mon Sep 17 00:00:00 2001 From: Matthew Kenigsberg Date: Mon, 19 Feb 2024 12:01:26 -0600 Subject: [PATCH] no_channel_add -> add_channel --- src/action/common/configure_nix.rs | 6 +++--- src/settings.rs | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/action/common/configure_nix.rs b/src/action/common/configure_nix.rs index 13f396fcc..cc2b8eae5 100644 --- a/src/action/common/configure_nix.rs +++ b/src/action/common/configure_nix.rs @@ -55,14 +55,14 @@ impl ConfigureNix { .await .map_err(Self::error)?; - let setup_channels = if settings.no_channel_add { - None - } else { + let setup_channels = if settings.add_channel { Some( SetupChannels::plan(PathBuf::from(SCRATCH_DIR)) .await .map_err(Self::error)?, ) + } else { + None }; Ok(Self { diff --git a/src/settings.rs b/src/settings.rs index c00d7c4da..1b57cbd12 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -250,13 +250,14 @@ pub struct CommonSettings { #[cfg_attr( feature = "cli", clap( - long, - default_value = "false", - env = "NIX_INSTALLER_NO_CHANNEL_ADD", - global = true + action(ArgAction::SetFalse), + default_value = "true", + global = true, + env = "NIX_INSTALLER_ADD_CHANNEL", + long("no-add-channel"), ) )] - pub no_channel_add: bool, + pub add_channel: bool, } impl CommonSettings { @@ -329,7 +330,7 @@ impl CommonSettings { diagnostic_attribution: None, #[cfg(feature = "diagnostics")] diagnostic_endpoint: Some("https://install.determinate.systems/nix/diagnostic".into()), - no_channel_add: false, + add_channel: false, }) } @@ -351,7 +352,7 @@ impl CommonSettings { diagnostic_attribution: _, #[cfg(feature = "diagnostics")] diagnostic_endpoint, - no_channel_add, + add_channel, } = self; let mut map = HashMap::default(); @@ -395,8 +396,8 @@ impl CommonSettings { ); map.insert( - "no_channel_add".into(), - serde_json::to_value(no_channel_add)?, + "add_channel".into(), + serde_json::to_value(add_channel)?, ); Ok(map)