@@ -54,7 +54,7 @@ impl DarwinRebuildArgs {
5454 platform:: resolve_env_installable ( "NH_DARWIN_FLAKE" , self . common . installable . clone ( ) ) ;
5555
5656 // Build the configuration
57- let _target_profile = platform:: handle_rebuild_workflow (
57+ let target_profile = platform:: handle_rebuild_workflow (
5858 installable,
5959 "darwinConfigurations" ,
6060 & [ "toplevel" ] ,
@@ -71,6 +71,7 @@ impl DarwinRebuildArgs {
7171 false , // Don't skip comparison
7272 ) ?;
7373
74+ // Check if user wants to proceed with applying the configuration
7475 if self . common . ask && !self . common . dry && !matches ! ( variant, Build ) {
7576 info ! ( "Apply the config?" ) ;
7677 let confirmation = dialoguer:: Confirm :: new ( ) . default ( false ) . interact ( ) ?;
@@ -81,15 +82,18 @@ impl DarwinRebuildArgs {
8182 }
8283
8384 if matches ! ( variant, Switch ) && !self . common . dry {
85+ // Clone target_profile to avoid moved value errors
86+ let target_profile_path = target_profile. clone ( ) ;
87+
8488 Command :: new ( "nix" )
8589 . args ( [ "build" , "--no-link" , "--profile" , SYSTEM_PROFILE ] )
86- . arg ( out_path . get_path ( ) )
90+ . arg ( target_profile_path . as_path ( ) )
8791 . elevate ( true )
8892 . dry ( self . common . dry )
8993 . run ( ) ?;
9094
91- let darwin_rebuild = out_path . get_path ( ) . join ( "sw/bin/darwin-rebuild" ) ;
92- let activate_user = out_path . get_path ( ) . join ( "activate-user" ) ;
95+ let darwin_rebuild = target_profile_path . join ( "sw/bin/darwin-rebuild" ) ;
96+ let activate_user = target_profile_path . join ( "activate-user" ) ;
9397
9498 // Determine if we need to elevate privileges
9599 let needs_elevation = !activate_user. try_exists ( ) . unwrap_or ( false )
@@ -120,18 +124,15 @@ impl DarwinReplArgs {
120124 let installable = platform:: resolve_env_installable ( "NH_DARWIN_FLAKE" , self . installable ) ;
121125
122126 // Get hostname for the configuration
123- let hostname = match self . hostname {
124- Some ( h) => h,
125- None => crate :: util:: get_hostname ( ) ?,
126- } ;
127+ let ( hostname, _) = platform:: get_target_hostname ( self . hostname , false ) ?;
127128
128129 // Start an interactive Nix REPL with the darwin configuration
129130 platform:: run_repl (
130131 installable,
131132 "darwinConfigurations" ,
132133 & [ ] , // No extra path needed
133134 Some ( hostname) ,
134- & [ ] , // No extra arguments
135+ & [ ] , // No extra args
135136 )
136137 }
137138}
0 commit comments