1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-28 13:11:00 +01:00

Put the builder context in a struct

This commit is contained in:
Eelco Dolstra 2025-05-01 12:46:40 +02:00
parent 40bbad3be5
commit fe0124fe17
5 changed files with 40 additions and 51 deletions

View file

@ -3,17 +3,15 @@
namespace nix {
static void builtinUnpackChannel(
const BasicDerivation & drv,
const std::map<std::string, Path> & outputs)
static void builtinUnpackChannel(const BuiltinBuilderContext & ctx)
{
auto getAttr = [&](const std::string & name) -> const std::string & {
auto i = drv.env.find(name);
if (i == drv.env.end()) throw Error("attribute '%s' missing", name);
auto i = ctx.drv.env.find(name);
if (i == ctx.drv.env.end()) throw Error("attribute '%s' missing", name);
return i->second;
};
std::filesystem::path out{outputs.at("out")};
std::filesystem::path out{ctx.outputs.at("out")};
auto & channelName = getAttr("channelName");
auto & src = getAttr("src");