diff --git a/src/nix/bundle.cc b/src/nix/bundle.cc index 3d953ebc0..113ceca33 100644 --- a/src/nix/bundle.cc +++ b/src/nix/bundle.cc @@ -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; diff --git a/tests/flake-bundler.sh b/tests/flake-bundler.sh index 2e52f999d..30e2fbd1d 100644 --- a/tests/flake-bundler.sh +++ b/tests/flake-bundler.sh @@ -10,8 +10,15 @@ cd $TEST_HOME cat < 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