diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index b7dab885f968f5288e95dd06c1dfe4d0cc9ed4b8..195cb0db3acc7afb4c31112040b2b76672f00f31 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -8,10 +8,6 @@
 
 #include <map>
 
-#if HAVE_BOEHMGC
-#include <gc/gc_allocator.h>
-#endif
-
 
 namespace nix {
 
diff --git a/src/libexpr/value.hh b/src/libexpr/value.hh
index 048522016c629f5ea03a86773ee8e949a39a63c3..271e6a1b24a225f451a369476882d1f06e85eb17 100644
--- a/src/libexpr/value.hh
+++ b/src/libexpr/value.hh
@@ -1,7 +1,12 @@
 #pragma once
 
+#include "config.h"
 #include "symbol-table.hh"
 
+#if HAVE_BOEHMGC
+#include <gc/gc_allocator.h>
+#endif
+
 namespace nix {