forked from lix-project/lix
* Allow the top-level expression to be a derivation.
* Hack: `nix-env -i *' installs all available derivations.
This commit is contained in:
parent
496934a99c
commit
b857267893
|
@ -53,15 +53,17 @@ bool parseDerivations(EvalState & state, Expr e, DrvInfos & drvs)
|
||||||
{
|
{
|
||||||
ATMatcher m;
|
ATMatcher m;
|
||||||
ATermList es;
|
ATermList es;
|
||||||
|
DrvInfo drv;
|
||||||
|
|
||||||
e = evalExpr(state, e);
|
e = evalExpr(state, e);
|
||||||
|
|
||||||
if (atMatch(m, e) >> "Attrs") {
|
if (parseDerivation(state, e, drv))
|
||||||
|
drvs[drv.drvPath] = drv;
|
||||||
|
|
||||||
|
else if (atMatch(m, e) >> "Attrs") {
|
||||||
ATermMap drvMap;
|
ATermMap drvMap;
|
||||||
queryAllAttrs(e, drvMap);
|
queryAllAttrs(e, drvMap);
|
||||||
|
|
||||||
for (ATermIterator i(drvMap.keys()); i; ++i) {
|
for (ATermIterator i(drvMap.keys()); i; ++i) {
|
||||||
DrvInfo drv;
|
|
||||||
debug(format("evaluating attribute `%1%'") % *i);
|
debug(format("evaluating attribute `%1%'") % *i);
|
||||||
if (parseDerivation(state, drvMap.get(*i), drv))
|
if (parseDerivation(state, drvMap.get(*i), drv))
|
||||||
drvs[drv.drvPath] = drv;
|
drvs[drv.drvPath] = drv;
|
||||||
|
@ -70,7 +72,6 @@ bool parseDerivations(EvalState & state, Expr e, DrvInfos & drvs)
|
||||||
|
|
||||||
else if (atMatch(m, e) >> "List" >> es) {
|
else if (atMatch(m, e) >> "List" >> es) {
|
||||||
for (ATermIterator i(es); i; ++i) {
|
for (ATermIterator i(es); i; ++i) {
|
||||||
DrvInfo drv;
|
|
||||||
debug(format("evaluating list element"));
|
debug(format("evaluating list element"));
|
||||||
if (parseDerivation(state, *i, drv))
|
if (parseDerivation(state, *i, drv))
|
||||||
drvs[drv.drvPath] = drv;
|
drvs[drv.drvPath] = drv;
|
||||||
|
@ -243,6 +244,9 @@ void installDerivations(EvalState & state,
|
||||||
|
|
||||||
/* Filter out the ones we're not interested in. */
|
/* Filter out the ones we're not interested in. */
|
||||||
DrvInfos selectedDrvs;
|
DrvInfos selectedDrvs;
|
||||||
|
if (drvNames.size() > 0 && drvNames.front() == "*") { /* !!! hack */
|
||||||
|
selectedDrvs = availDrvs;
|
||||||
|
} else {
|
||||||
for (Strings::iterator i = drvNames.begin();
|
for (Strings::iterator i = drvNames.begin();
|
||||||
i != drvNames.end(); ++i)
|
i != drvNames.end(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -252,6 +256,7 @@ void installDerivations(EvalState & state,
|
||||||
else
|
else
|
||||||
selectedDrvs[j->second] = availDrvs[j->second];
|
selectedDrvs[j->second] = availDrvs[j->second];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Add in the already installed derivations. */
|
/* Add in the already installed derivations. */
|
||||||
DrvInfos installedDrvs;
|
DrvInfos installedDrvs;
|
||||||
|
|
Loading…
Reference in a new issue