You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are using `nix-installer` in an automated curing process and seeing this message, consider pinning the version you use via https://github.com/DeterminateSystems/nix-installer#accessing-other-versions.\
34
33
";
35
34
35
+
constPRE_PKG_SUGGEST:&str = "For a more robust Nix installation, use the Determinate package for macOS: https://dtr.mn/determinate-nix";
36
+
37
+
constDETERMINATE_MSG_EXPLAINER:&str = "\
38
+
Determinate Nix is Determinate Systems' validated and secure downstream Nix distribution for enterprises. \
39
+
It comes bundled with Determinate Nixd, a helpful daemon that automates some otherwise-unpleasant aspects of using Nix, such as garbage collection, and enables you to easily authenticate with FlakeHub.
Found existing plan in `{RECEIPT_LOCATION}` which was created by a version incompatible `nix-installer`.\n\
127
-
{EXISTING_INCOMPATIBLE_PLAN_GUIDANCE}\n\
128
-
").red()
129
-
);
130
-
returnOk(ExitCode::FAILURE)
131
-
}
132
-
if existing_receipt.planner.typetag_name() != chosen_planner.typetag_name(){
133
-
eprintln!("{}", format!("Found existing plan in `{RECEIPT_LOCATION}` which used a different planner, try uninstalling the existing install with `{uninstall_command}`").red());
134
-
returnOk(ExitCode::FAILURE)
135
-
}
136
-
if existing_receipt.planner.settings().map_err(|e| eyre!(e))? != chosen_planner.settings().map_err(|e| eyre!(e))? {
137
-
eprintln!("{}", format!("Found existing plan in `{RECEIPT_LOCATION}` which used different planner settings, try uninstalling the existing install with `{uninstall_command}`").red());
138
-
returnOk(ExitCode::FAILURE)
139
-
}
140
-
eprintln!("{}", format!("Found existing plan in `{RECEIPT_LOCATION}`, with the same settings, already completed. Try uninstalling (`{uninstall_command}`) and reinstalling if Nix isn't working").red());
141
-
returnOk(ExitCode::SUCCESS)
142
-
},
143
-
None => {
144
-
let res = planner.plan().await;
145
-
match res {
146
-
Ok(plan) => plan,
147
-
Err(err) => {
148
-
ifletSome(expected) = err.expected(){
149
-
eprintln!("{}", expected.red());
150
-
returnOk(ExitCode::FAILURE);
151
-
}
152
-
returnErr(err)?;
153
-
}
154
-
}
155
-
},
156
-
}
157
-
},
158
-
(None,Some(plan_path)) => {
159
-
let install_plan_string = tokio::fs::read_to_string(&plan_path)
122
+
if plan.is_some() && maybe_planner.is_some(){
123
+
returnErr(eyre!("`--plan` conflicts with passing a planner, a planner creates plans, so passing an existing plan doesn't make sense"));
Found existing plan in `{RECEIPT_LOCATION}` which was created by a version incompatible `nix-installer`.\n\
178
-
{EXISTING_INCOMPATIBLE_PLAN_GUIDANCE}\n\
179
-
").red()
180
-
);
181
-
returnOk(ExitCode::FAILURE)
182
-
}
183
-
if existing_receipt.planner.typetag_name() != builtin_planner.typetag_name(){
184
-
eprintln!("{}", format!("Found existing plan in `{RECEIPT_LOCATION}` which used a different planner, try uninstalling the existing install with `{uninstall_command}`").red());
185
-
returnOk(ExitCode::FAILURE)
186
-
}
187
-
if existing_receipt.planner.settings().map_err(|e| eyre!(e))? != builtin_planner.settings().map_err(|e| eyre!(e))? {
188
-
eprintln!("{}", format!("Found existing plan in `{RECEIPT_LOCATION}` which used different planner settings, try uninstalling the existing install with `{uninstall_command}`").red());
189
-
returnOk(ExitCode::FAILURE)
190
-
}
191
-
if existing_receipt.actions.iter().all(|v| v.state == ActionState::Completed){
192
-
eprintln!("{}", format!("Found existing plan in `{RECEIPT_LOCATION}`, with the same settings, already completed. Try uninstalling (`{uninstall_command}`) and reinstalling if Nix isn't working").yellow());
Found existing plan in `{RECEIPT_LOCATION}` which was created by a version incompatible `nix-installer`.\n\
162
+
{EXISTING_INCOMPATIBLE_PLAN_GUIDANCE}\n\
163
+
").red()
164
+
);
165
+
returnOk(ExitCode::FAILURE);
166
+
}
167
+
168
+
if existing_receipt.planner.typetag_name() != planner.typetag_name(){
169
+
eprintln!("{}", format!("Found existing plan in `{RECEIPT_LOCATION}` which used a different planner, try uninstalling the existing install with `{uninstall_command}`").red());
170
+
returnOk(ExitCode::FAILURE);
171
+
}
172
+
173
+
if existing_receipt.planner.settings().map_err(|e| eyre!(e))?
174
+
!= planner.settings().map_err(|e| eyre!(e))?
175
+
{
176
+
eprintln!("{}", format!("Found existing plan in `{RECEIPT_LOCATION}` which used different planner settings, try uninstalling the existing install with `{uninstall_command}`").red());
177
+
returnOk(ExitCode::FAILURE);
178
+
}
179
+
180
+
eprintln!("{}", format!("Found existing plan in `{RECEIPT_LOCATION}`, with the same settings, already completed. Try uninstalling (`{uninstall_command}`) and reinstalling if Nix isn't working").red());
181
+
returnOk(ExitCode::SUCCESS);
182
+
},
183
+
None => {
184
+
let planner_settings = planner.common_settings_mut();
185
+
186
+
if !planner_settings.determinate_nix{
187
+
if !std::io::stdin().is_terminal() || no_confirm {
.unwrap_or("Consider using Determinate Nix, for less fuss: https://dtr.mn/determinate-nix\n".into());
192
+
post_install_message = Some(msg);
193
+
}else{
194
+
let base_prompt = feedback
195
+
.get_feature_ptr_payload::<String>(
196
+
"dni-det-msg-interactive-prompt-ptr",
197
+
)
198
+
.await
199
+
.unwrap_or("Install Determinate Nix?".into());
200
+
let explanation = feedback
201
+
.get_feature_ptr_payload::<String>(
202
+
"dni-det-msg-interactive-explanation-ptr",
203
+
)
204
+
.await
205
+
.unwrap_or(DETERMINATE_MSG_EXPLAINER.into());
206
+
207
+
letmut currently_explaining = explain;
208
+
209
+
loop{
210
+
let prompt = if currently_explaining {
211
+
&format!(
212
+
"\n{}\n{}\n",
213
+
base_prompt.trim().green(),
214
+
explanation.trim()
215
+
)
216
+
}else{
217
+
&format!("\n{}", base_prompt.trim().green())
218
+
};
219
+
220
+
let response = interaction::prompt(
221
+
prompt.to_string(),
222
+
PromptChoice::Yes,
223
+
currently_explaining,
224
+
)
225
+
.await?;
226
+
227
+
match response {
228
+
PromptChoice::Explain => {
229
+
currently_explaining = true;
230
+
},
231
+
PromptChoice::Yes => {
232
+
planner_settings.determinate_nix = true;
233
+
break;
234
+
},
235
+
PromptChoice::No => {
236
+
break;
237
+
},
205
238
}
206
-
returnErr(err)?;
207
239
}
208
240
}
209
-
},
210
-
}
211
-
},
212
-
(Some(_),Some(_)) => returnErr(eyre!("`--plan` conflicts with passing a planner, a planner creates plans, so passing an existing plan doesn't make sense")),
0 commit comments