1- use std:: io:: IsTerminal as _;
2-
3- use owo_colors:: OwoColorize as _;
4-
5- use crate :: cli:: interaction:: PromptChoice ;
61use crate :: feedback:: Feedback ;
7- use crate :: planner:: BuiltinPlanner ;
82
93const 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-
275pub ( 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- "\n The 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- }
0 commit comments