diff --git a/daemon.am b/daemon.am
index e314e4d222ceab63771db3e710045f631c773d6a..0c9bc9fb69e8c792b4573a43a4dc625c650070ef 100644
--- a/daemon.am
+++ b/daemon.am
@@ -105,6 +105,7 @@ libstore_headers =				\
 libstore_a_CPPFLAGS =				\
   $(libutil_a_CPPFLAGS)				\
   -I$(top_srcdir)/nix/libstore			\
+  -I$(top_builddir)/nix/libstore		\
   -DNIX_STORE_DIR=\"$(storedir)\"		\
   -DNIX_DATA_DIR=\"$(datadir)\"			\
   -DNIX_STATE_DIR=\"$(localstatedir)/nix\"	\