bundler: revert default behavior to use defaultApp
Bundlers are now responsible for correctly handling their inputs which are no longer constrained to be (Drv->Drv)->Drv->Drv, but can be of type (attrset->Drv)->attrset->Drv.
This commit is contained in:
parent
dc85e20684
commit
4ebc50d92e
2 changed files with 16 additions and 4 deletions
|
@ -51,7 +51,9 @@ struct CmdBundle : InstallableCommand
|
|||
|
||||
Strings getDefaultFlakeAttrPaths() override
|
||||
{
|
||||
Strings res{"defaultPackage." + settings.thisSystem.get()};
|
||||
Strings res{
|
||||
"defaultApp." + settings.thisSystem.get()
|
||||
};
|
||||
for (auto & s : SourceExprCommand::getDefaultFlakeAttrPaths())
|
||||
res.push_back(s);
|
||||
return res;
|
||||
|
@ -59,7 +61,10 @@ struct CmdBundle : InstallableCommand
|
|||
|
||||
Strings getDefaultFlakeAttrPathPrefixes() override
|
||||
{
|
||||
Strings res{"packages." + settings.thisSystem.get() + "."};
|
||||
Strings res{
|
||||
"apps." + settings.thisSystem.get() + "."
|
||||
|
||||
};
|
||||
for (auto & s : SourceExprCommand::getDefaultFlakeAttrPathPrefixes())
|
||||
res.push_back(s);
|
||||
return res;
|
||||
|
@ -73,7 +78,7 @@ struct CmdBundle : InstallableCommand
|
|||
const flake::LockFlags lockFlagsProg{ .writeLockFile = false };
|
||||
auto programInstallable = InstallableFlake(this,
|
||||
evalState, std::move(progFlakeRef),
|
||||
Strings{progName == "" ? "defaultPackage" : progName},
|
||||
Strings{progName == "" ? "defaultApp" : progName},
|
||||
Strings(this->getDefaultFlakeAttrPathPrefixes()),
|
||||
lockFlagsProg);
|
||||
auto val = programInstallable.toValue(*evalState).first;
|
||||
|
|
|
@ -10,8 +10,15 @@ cd $TEST_HOME
|
|||
cat <<EOF > flake.nix
|
||||
{
|
||||
outputs = {self}: {
|
||||
defaultBundler.$system = drv: drv;
|
||||
defaultBundler.$system = drv:
|
||||
if drv?type && drv.type == "derivation"
|
||||
then drv
|
||||
else self.defaultPackage.$system;
|
||||
defaultPackage.$system = import ./simple.nix;
|
||||
defaultApp.$system = {
|
||||
type = "app";
|
||||
program = "\${import ./simple.nix}/hello";
|
||||
};
|
||||
};
|
||||
}
|
||||
EOF
|
||||
|
|
Loading…
Reference in a new issue