@@ -54,7 +54,7 @@ impl DarwinRebuildArgs {
54
54
platform:: resolve_env_installable ( "NH_DARWIN_FLAKE" , self . common . installable . clone ( ) ) ;
55
55
56
56
// Build the configuration
57
- let _target_profile = platform:: handle_rebuild_workflow (
57
+ let target_profile = platform:: handle_rebuild_workflow (
58
58
installable,
59
59
"darwinConfigurations" ,
60
60
& [ "toplevel" ] ,
@@ -71,6 +71,7 @@ impl DarwinRebuildArgs {
71
71
false , // Don't skip comparison
72
72
) ?;
73
73
74
+ // Check if user wants to proceed with applying the configuration
74
75
if self . common . ask && !self . common . dry && !matches ! ( variant, Build ) {
75
76
info ! ( "Apply the config?" ) ;
76
77
let confirmation = dialoguer:: Confirm :: new ( ) . default ( false ) . interact ( ) ?;
@@ -81,15 +82,18 @@ impl DarwinRebuildArgs {
81
82
}
82
83
83
84
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
+
84
88
Command :: new ( "nix" )
85
89
. args ( [ "build" , "--no-link" , "--profile" , SYSTEM_PROFILE ] )
86
- . arg ( out_path . get_path ( ) )
90
+ . arg ( target_profile_path . as_path ( ) )
87
91
. elevate ( true )
88
92
. dry ( self . common . dry )
89
93
. run ( ) ?;
90
94
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" ) ;
93
97
94
98
// Determine if we need to elevate privileges
95
99
let needs_elevation = !activate_user. try_exists ( ) . unwrap_or ( false )
@@ -120,18 +124,15 @@ impl DarwinReplArgs {
120
124
let installable = platform:: resolve_env_installable ( "NH_DARWIN_FLAKE" , self . installable ) ;
121
125
122
126
// 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 ) ?;
127
128
128
129
// Start an interactive Nix REPL with the darwin configuration
129
130
platform:: run_repl (
130
131
installable,
131
132
"darwinConfigurations" ,
132
133
& [ ] , // No extra path needed
133
134
Some ( hostname) ,
134
- & [ ] , // No extra arguments
135
+ & [ ] , // No extra args
135
136
)
136
137
}
137
138
}
0 commit comments