1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 12:41:15 +02:00

Merge branch 'master' into no-manifests

This commit is contained in:
Eelco Dolstra 2012-07-26 15:14:33 -04:00
commit 8c79100839
50 changed files with 343 additions and 307 deletions

View file

@ -1,20 +1,13 @@
#ifndef __ATTR_PATH_H
#define __ATTR_PATH_H
#pragma once
#include "eval.hh"
#include <string>
#include <map>
namespace nix {
void findAlongAttrPath(EvalState & state, const string & attrPath,
Bindings & autoArgs, Expr * e, Value & v);
}
#endif /* !__ATTR_PATH_H */

View file

@ -1,9 +1,7 @@
#ifndef __COMMON_OPTS_H
#define __COMMON_OPTS_H
#pragma once
#include "eval.hh"
namespace nix {
/* Some common option parsing between nix-env and nix-instantiate. */
@ -17,6 +15,3 @@ bool parseSearchPathArg(const string & arg, Strings::iterator & i,
Path lookupFileArg(EvalState & state, string s);
}
#endif /* !__COMMON_OPTS_H */

View file

@ -1,5 +1,4 @@
#ifndef __EVAL_INLINE_H
#define __EVAL_INLINE_H
#pragma once
#include "eval.hh"
@ -8,7 +7,6 @@
namespace nix {
LocalNoInlineNoReturn(void throwEvalError(const char * s))
{
throw EvalError(s);
@ -55,7 +53,4 @@ inline void EvalState::forceList(Value & v)
throwTypeError("value is %1% while a list was expected", showType(v));
}
}
#endif /* !__EVAL_INLINE_H */

View file

@ -1,5 +1,4 @@
#ifndef __EVAL_H
#define __EVAL_H
#pragma once
#include "value.hh"
#include "nixexpr.hh"
@ -256,6 +255,3 @@ string showType(const Value & v);
}
#endif /* !__EVAL_H */

View file

@ -1,5 +1,4 @@
#ifndef __GET_DRVS_H
#define __GET_DRVS_H
#pragma once
#include "eval.hh"
@ -83,6 +82,3 @@ void getDerivations(EvalState & state, Value & v, const string & pathPrefix,
}
#endif /* !__GET_DRVS_H */

View file

@ -1,12 +1,9 @@
#ifndef __NAMES_H
#define __NAMES_H
#pragma once
#include "types.hh"
namespace nix {
struct DrvName
{
string fullName;
@ -19,15 +16,9 @@ struct DrvName
bool matches(DrvName & n);
};
typedef list<DrvName> DrvNames;
int compareVersions(const string & v1, const string & v2);
DrvNames drvNamesFromArgs(const Strings & opArgs);
}
#endif /* !__NAMES_H */

View file

@ -1,5 +1,4 @@
#ifndef __NIXEXPR_H
#define __NIXEXPR_H
#pragma once
#include "value.hh"
#include "symbol-table.hh"
@ -290,6 +289,3 @@ struct StaticEnv
}
#endif /* !__NIXEXPR_H */

View file

@ -65,7 +65,31 @@ static void prim_import(EvalState & state, Value * * args, Value & v)
}
}
state.evalFile(path, v);
if (isStorePath(path) && store->isValidPath(path) && isDerivation(path)) {
Derivation drv = parseDerivation(readFile(path));
Value & w = *state.allocValue();
state.mkAttrs(w, 1 + drv.outputs.size());
mkString(*state.allocAttr(w, state.sDrvPath), path, singleton<PathSet>("=" + path));
state.mkList(*state.allocAttr(w, state.symbols.create("outputs")), drv.outputs.size());
unsigned int outputs_index = 0;
Value * outputsVal = w.attrs->find(state.symbols.create("outputs"))->value;
foreach (DerivationOutputs::iterator, i, drv.outputs) {
mkString(*state.allocAttr(w, state.symbols.create(i->first)),
i->second.path, singleton<PathSet>("!" + i->first + "!" + path));
mkString(*(outputsVal->list.elems[outputs_index++] = state.allocValue()),
i->first);
}
w.attrs->sort();
Value fun;
state.mkThunk_(fun,
state.parseExprFromFile(state.findFile("nix/imported-drv-to-derivation.nix")));
state.forceFunction(fun);
mkApp(v, fun, w);
state.forceAttrs(v);
} else {
state.evalFile(path, v);
}
}

View file

@ -1,5 +1,4 @@
#ifndef __SYMBOL_TABLE_H
#define __SYMBOL_TABLE_H
#pragma once
#include "config.h"
@ -88,5 +87,3 @@ public:
};
}
#endif /* !__SYMBOL_TABLE_H */

View file

@ -1,5 +1,4 @@
#ifndef __VALUE_TO_XML_H
#define __VALUE_TO_XML_H
#pragma once
#include "nixexpr.hh"
#include "eval.hh"
@ -13,5 +12,3 @@ void printValueAsXML(EvalState & state, bool strict, bool location,
Value & v, std::ostream & out, PathSet & context);
}
#endif /* !__VALUE_TO_XML_H */

View file

@ -1,5 +1,4 @@
#ifndef __VALUE_H
#define __VALUE_H
#pragma once
#include "symbol-table.hh"
@ -151,5 +150,3 @@ void mkPath(Value & v, const char * s);
}
#endif /* !__VALUE_H */