Skip to content

Commit 6c62aa1

Browse files
authored
Default to Determinate Nix, and drop the prompt (#1692)
Implements https://determinate.systems/blog/installer-dropping-upstream/
1 parent 63224d9 commit 6c62aa1

File tree

6 files changed

+9
-155
lines changed

6 files changed

+9
-155
lines changed
Lines changed: 0 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,7 @@
1-
use std::io::IsTerminal as _;
2-
3-
use owo_colors::OwoColorize as _;
4-
5-
use crate::cli::interaction::PromptChoice;
61
use crate::feedback::Feedback;
7-
use crate::planner::BuiltinPlanner;
82

93
const PRE_PKG_SUGGEST: &str = "For a more robust Nix installation, use the Determinate package for macOS: https://dtr.mn/determinate-nix";
104

11-
const INSTALL_DETERMINATE_NIX_PROMPT: &str = "\
12-
Install Determinate Nix?
13-
14-
It has stable flakes, lazy trees, parallel evaluation, and more.
15-
16-
Selecting 'no' will install upstream Nix, which comes from NixOS.org.\
17-
";
18-
19-
const DETERMINATE_MSG_EXPLAINER: &str = "\
20-
Determinate Nix is Determinate Systems' validated and secure downstream Nix distribution for enterprises. \
21-
It is the direct result of our work to ship meaningful user experience and reliability improvements to Nix.
22-
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.
23-
24-
For more details: https://dtr.mn/determinate-nix\
25-
";
26-
275
pub(crate) async fn inform_macos_about_pkg<T: Feedback>(feedback: &T) {
286
if matches!(
297
target_lexicon::OperatingSystem::host(),
@@ -36,117 +14,3 @@ pub(crate) async fn inform_macos_about_pkg<T: Feedback>(feedback: &T) {
3614
tracing::info!("{}", msg.trim());
3715
}
3816
}
39-
40-
pub(crate) async fn prompt_for_determinate<T: Feedback>(
41-
feedback: &mut T,
42-
planner: &mut BuiltinPlanner,
43-
no_confirm: bool,
44-
) -> eyre::Result<Option<String>> {
45-
let planner_settings = planner.common_settings_mut();
46-
47-
if !planner_settings.determinate_nix {
48-
// This is deliberately checking the determinate_nix option, and not `.distribution()`.
49-
// When we default to Determinate Nix on November 10, we'll change prefer_upstream's default to false.
50-
// Then, .distribution() will be Determinate Nix, but .determinate_nix will still be false.
51-
// That means we'll still show this warning.
52-
53-
eprintln!();
54-
eprintln!(
55-
"{} The Determinate Nix Installer will stop distributing upstream Nix no sooner than {}.",
56-
"Important:".bold().red().italic(),
57-
"January 1, 2026".italic()
58-
);
59-
60-
eprintln!("\n{}", "Timeline".bold().underline());
61-
62-
eprintln!(
63-
"* {}: we are changing the installer to default to Determinate Nix.",
64-
"November 10".bold()
65-
);
66-
eprintln!(
67-
" You can add the `{}` flag now to keep upstream Nix as the default.",
68-
"--prefer-upstream-nix".italic()
69-
);
70-
eprintln!(
71-
"* {}: we are removing support for installing upstream Nix.",
72-
"January 1".bold()
73-
);
74-
eprintln!(
75-
" The `{}` flag will not have an effect any longer.",
76-
"--prefer-upstream-nix".italic()
77-
);
78-
79-
eprintln!(
80-
"\nThe DeterminateSystems/nix-installer-action GitHub Action is also affected.\n"
81-
);
82-
eprintln!(
83-
"{} https://determinate.systems/blog/installer-dropping-upstream/",
84-
"Details:".bold().italic()
85-
);
86-
}
87-
88-
if planner_settings.distribution().is_upstream()
89-
&& std::io::stdin().is_terminal()
90-
&& !no_confirm
91-
{
92-
let base_prompt = feedback
93-
.get_feature_ptr_payload::<String>("dni-det-msg-interactive-prompt-ptr")
94-
.await
95-
.unwrap_or(INSTALL_DETERMINATE_NIX_PROMPT.into());
96-
97-
let mut explanation: Option<String> = None;
98-
99-
loop {
100-
let prompt = if let Some(ref explanation) = explanation {
101-
&format!("\n{}\n{}", base_prompt.trim().green(), explanation.trim())
102-
} else {
103-
&format!("\n{}", base_prompt.trim().green())
104-
};
105-
106-
let response = crate::cli::interaction::prompt(
107-
prompt.to_string(),
108-
PromptChoice::Yes,
109-
explanation.is_some(),
110-
)
111-
.await?;
112-
113-
match response {
114-
PromptChoice::Explain => {
115-
explanation = Some(
116-
feedback
117-
.get_feature_ptr_payload::<String>(
118-
"dni-det-msg-interactive-explanation-ptr",
119-
)
120-
.await
121-
.unwrap_or(DETERMINATE_MSG_EXPLAINER.into()),
122-
);
123-
},
124-
PromptChoice::Yes => {
125-
planner_settings.determinate_nix = true;
126-
break;
127-
},
128-
PromptChoice::No => {
129-
break;
130-
},
131-
}
132-
}
133-
}
134-
135-
let post_install_message_feature = match (
136-
planner_settings.distribution().is_determinate(),
137-
std::io::stdin().is_terminal() && !no_confirm,
138-
) {
139-
(true, true) => Some("dni-post-det-int-ptr"),
140-
(true, false) => None,
141-
(false, true) => Some("dni-post-ups-int-ptr"),
142-
(false, false) => Some("dni-post-ups-scr-ptr"),
143-
};
144-
145-
let msg = if let Some(feat) = post_install_message_feature {
146-
feedback.get_feature_ptr_payload::<String>(feat).await
147-
} else {
148-
None
149-
};
150-
151-
Ok(msg)
152-
}

src/cli/subcommand/install/mod.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,13 @@ impl CommandExecute for Install {
117117

118118
determinate::inform_macos_about_pkg(&feedback).await;
119119

120-
let mut post_install_message = None;
121-
122120
let mut install_plan = if let Some(plan_path) = plan {
123121
let install_plan_string = tokio::fs::read_to_string(&plan_path)
124122
.await
125123
.wrap_err("Reading plan")?;
126124
serde_json::from_str(&install_plan_string)?
127125
} else {
128-
let mut planner = match maybe_planner {
126+
let planner = match maybe_planner {
129127
Some(planner) => planner,
130128
None => BuiltinPlanner::from_common_settings(settings.clone())
131129
.await
@@ -162,10 +160,6 @@ impl CommandExecute for Install {
162160
return Ok(ExitCode::SUCCESS);
163161
}
164162

165-
post_install_message =
166-
determinate::prompt_for_determinate(&mut feedback, &mut planner, no_confirm)
167-
.await?;
168-
169163
feedback.set_planner(&planner).await?;
170164

171165
let res = planner.plan().await;
@@ -344,10 +338,6 @@ impl CommandExecute for Install {
344338
". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh".bold(),
345339
},
346340
);
347-
348-
if let Some(msg) = post_install_message {
349-
println!("{}\n", msg.trim());
350-
}
351341
},
352342
}
353343

src/settings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub struct CommonSettings {
6060
long = "prefer-upstream-nix",
6161
env = "NIX_INSTALLER_PREFER_UPSTREAM_NIX",
6262
// Note this default is replicated in a default() implementation
63-
default_value = "true"
63+
default_value = "false"
6464
)
6565
)]
6666
pub prefer_upstream: bool,
@@ -240,7 +240,7 @@ impl CommonSettings {
240240

241241
Ok(Self {
242242
determinate_nix: false,
243-
prefer_upstream: true,
243+
prefer_upstream: false,
244244
modify_profile: true,
245245
nix_build_group_name: String::from(crate::settings::DEFAULT_NIX_BUILD_USER_GROUP_NAME),
246246
nix_build_group_id: default_nix_build_group_id(),

tests/fixtures/linux/linux.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,8 +1144,8 @@
11441144
"planner": {
11451145
"planner": "linux",
11461146
"settings": {
1147-
"determinate_nix": false,
1148-
"prefer_upstream": true,
1147+
"determinate_nix": true,
1148+
"prefer_upstream": false,
11491149
"modify_profile": true,
11501150
"nix_build_group_name": "nixbld",
11511151
"nix_build_group_id": 30000,

tests/fixtures/linux/steam-deck.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,8 +1172,8 @@
11721172
"planner": "steam-deck",
11731173
"persistence": "/home/nix",
11741174
"settings": {
1175-
"determinate_nix": false,
1176-
"prefer_upstream": true,
1175+
"determinate_nix": true,
1176+
"prefer_upstream": false,
11771177
"modify_profile": true,
11781178
"nix_build_group_name": "nixbld",
11791179
"nix_build_group_id": 30000,

tests/fixtures/macos/macos.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,8 +1244,8 @@
12441244
"planner": {
12451245
"planner": "macos",
12461246
"settings": {
1247-
"determinate_nix": false,
1248-
"prefer_upstream": true,
1247+
"determinate_nix": true,
1248+
"prefer_upstream": false,
12491249
"modify_profile": true,
12501250
"nix_build_group_name": "nixbld",
12511251
"nix_build_group_id": 350,

0 commit comments

Comments
 (0)