aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-07-30 15:03:57 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2020-07-30 15:16:23 -0500
commit52407f83a133ba605a1f0891c3812fa89038bba8 (patch)
tree2db7827b03dbafd23d3d9fb1a04f8fcd4d32932a /src
parent5d04a4db9b3d8cbfbaacbc48a587d21d90844871 (diff)
exporter -> bundler
Diffstat (limited to 'src')
-rw-r--r--src/nix/bundle.cc (renamed from src/nix/export.cc)42
-rw-r--r--src/nix/flake.cc14
2 files changed, 28 insertions, 28 deletions
diff --git a/src/nix/export.cc b/src/nix/bundle.cc
index 9e7816605..e7338262b 100644
--- a/src/nix/export.cc
+++ b/src/nix/bundle.cc
@@ -6,18 +6,18 @@
using namespace nix;
-struct CmdExport : InstallableCommand
+struct CmdBundle : InstallableCommand
{
- std::string exporter = "github:matthewbauer/nix-bundle";
+ std::string bundler = "github:matthewbauer/nix-bundle";
Path outLink;
- CmdExport()
+ CmdBundle()
{
addFlag({
- .longName = "exporter",
- .description = "use custom exporter",
+ .longName = "bundler",
+ .description = "use custom bundler",
.labels = {"flake-url"},
- .handler = {&exporter},
+ .handler = {&bundler},
.completer = {[&](size_t, std::string_view prefix) {
completeFlakeRef(getStore(), prefix);
}}
@@ -35,15 +35,15 @@ struct CmdExport : InstallableCommand
std::string description() override
{
- return "export an application out of the Nix store";
+ return "bundle an application so that it works outside of the Nix store";
}
Examples examples() override
{
return {
Example{
- "To export Hello:",
- "nix export hello"
+ "To bundle Hello:",
+ "nix bundle hello"
},
};
}
@@ -71,12 +71,12 @@ struct CmdExport : InstallableCommand
auto app = installable->toApp(*evalState);
store->buildPaths(app.context);
- auto [exporterFlakeRef, exporterName] = parseFlakeRefWithFragment(exporter, absPath("."));
+ auto [bundlerFlakeRef, bundlerName] = parseFlakeRefWithFragment(bundler, absPath("."));
const flake::LockFlags lockFlags{ .writeLockFile = false };
- auto exporter = InstallableFlake(
- evalState, std::move(exporterFlakeRef),
- Strings{exporterName == "" ? ("defaultExporter." + settings.thisSystem.get()) : exporterName},
- Strings({"exporters." + settings.thisSystem.get() + "."}), lockFlags);
+ auto bundler = InstallableFlake(
+ evalState, std::move(bundlerFlakeRef),
+ Strings{bundlerName == "" ? ("defaultBundler." + settings.thisSystem.get()) : bundlerName},
+ Strings({"bundlers." + settings.thisSystem.get() + "."}), lockFlags);
Value * arg = evalState->allocValue();
evalState->mkAttrs(*arg, 1);
@@ -87,21 +87,21 @@ struct CmdExport : InstallableCommand
mkString(*evalState->allocAttr(*arg, evalState->symbols.create("program")), app.program, context);
auto vRes = evalState->allocValue();
- evalState->callFunction(*exporter.toValue(*evalState).first, *arg, *vRes, noPos);
+ evalState->callFunction(*bundler.toValue(*evalState).first, *arg, *vRes, noPos);
if (!evalState->isDerivation(*vRes))
- throw Error("the exporter '%s' does not produce a derivation", exporter.what());
+ throw Error("the bundler '%s' does not produce a derivation", bundler.what());
Bindings::iterator i = vRes->attrs->find(evalState->sDrvPath);
if (i == vRes->attrs->end())
- throw Error("the exporter '%s' does not produce a derivation", exporter.what());
+ throw Error("the bundler '%s' does not produce a bderivation", bundler.what());
PathSet context2;
StorePath drvPath = store->parseStorePath(evalState->coerceToPath(*i->pos, *i->value, context2));
i = vRes->attrs->find(evalState->sOutPath);
if (i == vRes->attrs->end())
- throw Error("the exporter '%s' does not produce a derivation", exporter.what());
+ throw Error("the bundler '%s' does not produce a derivation", bundler.what());
StorePath outPath = store->parseStorePath(evalState->coerceToPath(*i->pos, *i->value, context2));
@@ -110,11 +110,11 @@ struct CmdExport : InstallableCommand
auto accessor = store->getFSAccessor();
auto outPathS = store->printStorePath(outPath);
if (accessor->stat(outPathS).type != FSAccessor::tRegular)
- throw Error("'%s' is not a file; an exporter must only create a single file", outPathS);
+ throw Error("'%s' is not a file; a bundler must only create a single file", outPathS);
auto info = store->queryPathInfo(outPath);
if (!info->references.empty())
- throw Error("'%s' has references; an exporter must not leave any references", outPathS);
+ throw Error("'%s' has references; a bundler must not leave any references", outPathS);
if (outLink == "")
outLink = baseNameOf(app.program);
@@ -123,4 +123,4 @@ struct CmdExport : InstallableCommand
}
};
-static auto r2 = registerCommand<CmdExport>("export");
+static auto r2 = registerCommand<CmdBundle>("bundle");
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index cf7e4b7f5..1190d7997 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -368,14 +368,14 @@ struct CmdFlakeCheck : FlakeCommand
}
};
- auto checkExporter = [&](const std::string & attrPath, Value & v, const Pos & pos) {
+ auto checkBundler = [&](const std::string & attrPath, Value & v, const Pos & pos) {
try {
state->forceValue(v, pos);
if (v.type != tLambda)
- throw Error("exporter must be a function");
+ throw Error("bundler must be a function");
if (!v.lambda.fun->formals ||
v.lambda.fun->formals->argNames.find(state->symbols.create("program")) == v.lambda.fun->formals->argNames.end())
- throw Error("exporter must take formal argument 'program'");
+ throw Error("bundler must take formal argument 'program'");
} catch (Error & e) {
e.addTrace(pos, hintfmt("while checking the template '%s'", attrPath));
throw;
@@ -504,19 +504,19 @@ struct CmdFlakeCheck : FlakeCommand
*attr.value, *attr.pos);
}
- else if (name == "defaultExporter")
+ else if (name == "defaultBundler")
for (auto & attr : *vOutput.attrs) {
checkSystemName(attr.name, *attr.pos);
- checkExporter(fmt("%s.%s", name, attr.name), *attr.value, *attr.pos);
+ checkBundler(fmt("%s.%s", name, attr.name), *attr.value, *attr.pos);
}
- else if (name == "exporters") {
+ else if (name == "bundlers") {
state->forceAttrs(vOutput, pos);
for (auto & attr : *vOutput.attrs) {
checkSystemName(attr.name, *attr.pos);
state->forceAttrs(*attr.value, *attr.pos);
for (auto & attr2 : *attr.value->attrs)
- checkExporter(
+ checkBundler(
fmt("%s.%s.%s", name, attr.name, attr2.name),
*attr2.value, *attr2.pos);
}