bundler: pass drv attrset instead of path

This commit is contained in:
Tom Bereknyei 2021-10-31 13:19:53 -04:00
parent 0a70b37b56
commit 3be810f5db

View file

@ -71,6 +71,14 @@ struct CmdBundle : InstallableCommand
auto app = installable->toApp(*evalState).resolve(getEvalStore(), store); auto app = installable->toApp(*evalState).resolve(getEvalStore(), store);
auto [progFlakeRef, progName] = parseFlakeRefWithFragment(installable->what(), absPath("."));
const flake::LockFlags lockFlagsProg{ .writeLockFile = false };
auto programInstallable = InstallableFlake(this,
evalState, std::move(progFlakeRef),
Strings{progName == "" ? "defaultPackage" : progName},
Strings({"packages."+settings.thisSystem.get()+".","legacyPackages."+settings.thisSystem.get()+"."}), lockFlagsProg);
auto val = programInstallable.toValue(*evalState).first;
auto [bundlerFlakeRef, bundlerName] = parseFlakeRefWithFragment(bundler, absPath(".")); auto [bundlerFlakeRef, bundlerName] = parseFlakeRefWithFragment(bundler, absPath("."));
const flake::LockFlags lockFlags{ .writeLockFile = false }; const flake::LockFlags lockFlags{ .writeLockFile = false };
auto bundler = InstallableFlake(this, auto bundler = InstallableFlake(this,
@ -80,10 +88,12 @@ struct CmdBundle : InstallableCommand
auto attrs = evalState->buildBindings(2); auto attrs = evalState->buildBindings(2);
PathSet context; Value & prog = *evalState->allocAttr(*arg, evalState->symbols.create("program"));
for (auto & i : app.context) evalState->mkAttrs(prog,val->attrs->size());
context.insert("=" + store->printStorePath(i.path)); for (auto &j : *(val->attrs)){
attrs.alloc("program").mkString(app.program, context); prog.attrs->push_back(j);
}
prog.attrs->sort();
attrs.alloc("system").mkString(settings.thisSystem.get()); attrs.alloc("system").mkString(settings.thisSystem.get());