File tree 1 file changed +19
-10
lines changed
1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -135,23 +135,32 @@ impl DarwinRebuildArgs {
135
135
. args ( [ "build" , "--no-link" , "--profile" , SYSTEM_PROFILE ] )
136
136
. arg ( out_path. get_path ( ) )
137
137
. elevate ( true )
138
- . dry ( self . common . dry )
139
- . run ( ) ?;
138
+ . dry ( self . common . dry ) ;
140
139
141
- let switch_to_configuration = out_path. get_path ( ) . join ( "activate-user" ) ;
140
+ let activate_user = out_path. get_path ( ) . join ( "activate-user" ) ;
142
141
143
- Command :: new ( switch_to_configuration )
142
+ let user_activation = Command :: new ( activate_user . clone ( ) )
144
143
. message ( "Activating configuration for user" )
145
- . dry ( self . common . dry )
146
- . run ( ) ?;
144
+ . dry ( self . common . dry ) ;
147
145
148
- let switch_to_configuration = out_path. get_path ( ) . join ( "activate" ) ;
146
+ let activate = out_path. get_path ( ) . join ( "activate" ) ;
149
147
150
- Command :: new ( switch_to_configuration )
148
+ let activation = Command :: new ( activate )
151
149
. elevate ( true )
152
150
. 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
+ }
155
164
}
156
165
157
166
// Make sure out_path is not accidentally dropped
You can’t perform that action at this time.
0 commit comments