about summary refs log tree commit diff
path: root/src/libexpr/get-drvs.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-04-07T13·55+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-04-07T13·55+0000
commitfc92244ba81d884e099d467a3b82fbdcbff7fc40 (patch)
treefe66575aab172941946eab41f3974961fe00eb1b /src/libexpr/get-drvs.cc
parenta353aef0b157e7c628fd18640bd6c45215f3e606 (diff)
* Implemented the primops necessary for generating the NixOS manual.
Diffstat (limited to 'src/libexpr/get-drvs.cc')
-rw-r--r--src/libexpr/get-drvs.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc
index f02392bed5..6e651d77f0 100644
--- a/src/libexpr/get-drvs.cc
+++ b/src/libexpr/get-drvs.cc
@@ -105,10 +105,7 @@ static bool getDerivation(EvalState & state, Value & v,
 {
     try {
         state.forceValue(v);
-        if (v.type != tAttrs) return true;
-
-        Bindings::iterator i = v.attrs->find(toATerm("type"));
-        if (i == v.attrs->end() || state.forceStringNoCtx(i->second) != "derivation") return true;
+        if (!state.isDerivation(v)) return true;
 
         /* Remove spurious duplicates (e.g., an attribute set like
            `rec { x = derivation {...}; y = x;}'. */
@@ -117,7 +114,7 @@ static bool getDerivation(EvalState & state, Value & v,
 
         DrvInfo drv;
     
-        i = v.attrs->find(toATerm("name"));
+        Bindings::iterator i = v.attrs->find(toATerm("name"));
         /* !!! We really would like to have a decent back trace here. */
         if (i == v.attrs->end()) throw TypeError("derivation name missing");
         drv.name = state.forceStringNoCtx(i->second);