File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed
Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -135,23 +135,32 @@ impl DarwinRebuildArgs {
135135 . args ( [ "build" , "--no-link" , "--profile" , SYSTEM_PROFILE ] )
136136 . arg ( out_path. get_path ( ) )
137137 . elevate ( true )
138- . dry ( self . common . dry )
139- . run ( ) ?;
138+ . dry ( self . common . dry ) ;
140139
141- let switch_to_configuration = out_path. get_path ( ) . join ( "activate-user" ) ;
140+ let activate_user = out_path. get_path ( ) . join ( "activate-user" ) ;
142141
143- Command :: new ( switch_to_configuration )
142+ let user_activation = Command :: new ( activate_user . clone ( ) )
144143 . message ( "Activating configuration for user" )
145- . dry ( self . common . dry )
146- . run ( ) ?;
144+ . dry ( self . common . dry ) ;
147145
148- let switch_to_configuration = out_path. get_path ( ) . join ( "activate" ) ;
146+ let activate = out_path. get_path ( ) . join ( "activate" ) ;
149147
150- Command :: new ( switch_to_configuration )
148+ let activation = Command :: new ( activate )
151149 . elevate ( true )
152150 . message ( "Activating configuration" )
153- . dry ( self . common . dry )
154- . run ( ) ?;
151+ . dry ( self . common . dry ) ;
152+
153+ // Check whether to activate-user is deprecated
154+ // If it is, only activate with root
155+ if std:: fs:: read_to_string ( & activate_user)
156+ . context ( "Failed to read activate-user file" ) ?
157+ . contains ( "# nix-darwin: deprecated" )
158+ {
159+ activation. run ( ) ?;
160+ } else {
161+ user_activation. run ( ) ?;
162+ activation. run ( ) ?;
163+ }
155164 }
156165
157166 // Make sure out_path is not accidentally dropped
You can’t perform that action at this time.
0 commit comments