Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/nix/flake.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "nix/main/common-args.hh"
#include "nix/main/shared.hh"
#include "nix/expr/eval.hh"
#include "nix/expr/eval-gc.hh"
#include "nix/expr/eval-inline.hh"
#include "nix/expr/eval-settings.hh"
#include "nix/expr/get-drvs.hh"
Expand Down Expand Up @@ -723,9 +724,22 @@ struct CmdFlakeCheck : FlakeCommand

else if (name == "nixosConfigurations") {
state->forceAttrs(vOutput, pos, "");
for (auto & attr : *vOutput.attrs())

for (auto & attr : *vOutput.attrs()) {
// Save thunk state before forcing
Value savedValue = *attr.value;

checkNixOSConfiguration(
fmt("%s.%s", name, state->symbols[attr.name]), *attr.value, attr.pos);

// Restore thunk so evaluation tree becomes unreachable
*attr.value = savedValue;

// Trigger GC to free the evaluation tree before next config
#if NIX_USE_BOEHMGC
GC_gcollect();
#endif
}
}

else if (name == "hydraJobs")
Expand Down
Loading