diff options
author | Tom Bereknyei <tomberek@gmail.com> | 2021-10-31 13:19:53 -0400 |
---|---|---|
committer | Tom Bereknyei <tomberek@gmail.com> | 2022-01-24 21:43:04 -0500 |
commit | 3be810f5dbfaac8ced55e22fe8939c094e4a57fc (patch) | |
tree | cb62561beb7f3db9dfc76332b33603f4aac7ea2b /src/nix/bundle.cc | |
parent | 0a70b37b5694c769fb855c1afe7642407d1db64f (diff) |
bundler: pass drv attrset instead of path
Diffstat (limited to 'src/nix/bundle.cc')
-rw-r--r-- | src/nix/bundle.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/nix/bundle.cc b/src/nix/bundle.cc index adb5b3e73..9fc2656bb 100644 --- a/src/nix/bundle.cc +++ b/src/nix/bundle.cc @@ -71,6 +71,14 @@ struct CmdBundle : InstallableCommand 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(".")); const flake::LockFlags lockFlags{ .writeLockFile = false }; auto bundler = InstallableFlake(this, @@ -80,10 +88,12 @@ struct CmdBundle : InstallableCommand auto attrs = evalState->buildBindings(2); - PathSet context; - for (auto & i : app.context) - context.insert("=" + store->printStorePath(i.path)); - attrs.alloc("program").mkString(app.program, context); + Value & prog = *evalState->allocAttr(*arg, evalState->symbols.create("program")); + evalState->mkAttrs(prog,val->attrs->size()); + for (auto &j : *(val->attrs)){ + prog.attrs->push_back(j); + } + prog.attrs->sort(); attrs.alloc("system").mkString(settings.thisSystem.get()); |