@@ -97,6 +97,7 @@ pub struct ConfigHost {
9797
9898 pub host_config : Option < Value > ,
9999 pub nixos_config : OnceCell < Value > ,
100+ pub nixos_unchecked_config : OnceCell < Value > ,
100101 pub pkgs_override : Option < Value > ,
101102
102103 // TODO: Move command helpers away with connectivity refactor
@@ -377,9 +378,22 @@ impl ConfigHost {
377378
378379 Ok ( nixos_config)
379380 }
381+ pub async fn nixos_unchecked_config ( & self ) -> Result < Value > {
382+ if let Some ( v) = self . nixos_unchecked_config . get ( ) {
383+ return Ok ( v. clone ( ) ) ;
384+ }
385+ let Some ( host_config) = & self . host_config else {
386+ bail ! ( "local host has no nixos_config" ) ;
387+ } ;
388+ let nixos_config = nix_go ! ( host_config. nixos_unchecked. config) ;
389+
390+ let _ = self . nixos_unchecked_config . set ( nixos_config. clone ( ) ) ;
391+
392+ Ok ( nixos_config)
393+ }
380394
381395 pub async fn list_configured_secrets ( & self ) -> Result < Vec < String > > {
382- let nixos = self . nixos_config ( ) . await ?;
396+ let nixos = self . nixos_unchecked_config ( ) . await ?;
383397 let secrets = nix_go ! ( nixos. secrets) ;
384398 let mut out = Vec :: new ( ) ;
385399 for name in secrets. list_fields ( ) . await ? {
@@ -393,7 +407,7 @@ impl ConfigHost {
393407 Ok ( out)
394408 }
395409 pub async fn secret_field ( & self , name : & str ) -> Result < Value > {
396- let nixos = self . nixos_config ( ) . await ?;
410+ let nixos = self . nixos_unchecked_config ( ) . await ?;
397411 Ok ( nix_go ! ( nixos. secrets[ { name } ] ) )
398412 }
399413
@@ -434,6 +448,7 @@ impl Config {
434448 name : "<virtual localhost>" . to_owned ( ) ,
435449 host_config : None ,
436450 nixos_config : OnceCell :: new ( ) ,
451+ nixos_unchecked_config : OnceCell :: new ( ) ,
437452 groups : {
438453 let cell = OnceCell :: new ( ) ;
439454 let _ = cell. set ( vec ! [ ] ) ;
@@ -456,6 +471,7 @@ impl Config {
456471 name : name. to_owned ( ) ,
457472 host_config : Some ( host_config) ,
458473 nixos_config : OnceCell :: new ( ) ,
474+ nixos_unchecked_config : OnceCell :: new ( ) ,
459475 groups : OnceCell :: new ( ) ,
460476 pkgs_override : None ,
461477
0 commit comments