diff --git a/config.example.toml b/config.example.toml index 6540f726..c4ac70be 100644 --- a/config.example.toml +++ b/config.example.toml @@ -376,3 +376,8 @@ # during the pixi step # (default: false) # include_release_notes = false + +[rustup] +# If set, updates only these channels. +# (default: [] (all channels)) +# channels = ["stable"] diff --git a/src/config.rs b/src/config.rs index 91826749..18de4369 100644 --- a/src/config.rs +++ b/src/config.rs @@ -389,6 +389,12 @@ pub struct VscodeConfig { profile: Option, } +#[derive(Deserialize, Default, Debug, Merge)] +#[serde(deny_unknown_fields)] +pub struct Rustup { + channels: Option>, +} + #[derive(Deserialize, Default, Debug, Merge)] #[serde(deny_unknown_fields)] /// Configuration file @@ -473,6 +479,9 @@ pub struct ConfigFile { #[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)] vscode: Option, + + #[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)] + rustup: Option, } fn config_directory() -> PathBuf { @@ -1493,6 +1502,14 @@ impl Config { .unwrap_or(true) } + pub fn rustup_channels(&self) -> Vec { + self.config_file + .rustup + .as_ref() + .and_then(|rustup| rustup.channels.clone()) + .unwrap_or_default() + } + pub fn verbose(&self) -> bool { self.opt.verbose } diff --git a/src/steps/generic.rs b/src/steps/generic.rs index 0f6e0e9f..4736a3aa 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -262,7 +262,11 @@ pub fn run_rustup(ctx: &ExecutionContext) -> Result<()> { let rustup = require("rustup")?; print_separator("rustup"); - ctx.execute(rustup).arg("update").status_checked() + + ctx.execute(rustup) + .arg("update") + .args(ctx.config().rustup_channels()) + .status_checked() } pub fn run_rye(ctx: &ExecutionContext) -> Result<()> {