aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-07-30 15:18:48 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2020-07-30 15:18:57 -0500
commit22fcfdf18af84bbbbc1bd416a9eed37a64e26eb5 (patch)
tree91d090e8cf61c18678bbe761bd37906ab2579f60 /src/nix
parent1a705637ce96c30424409d74cb3411554ae2847e (diff)
Address misc review
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/bundle.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nix/bundle.cc b/src/nix/bundle.cc
index 677d42520..95aed5269 100644
--- a/src/nix/bundle.cc
+++ b/src/nix/bundle.cc
@@ -9,7 +9,7 @@ using namespace nix;
struct CmdBundle : InstallableCommand
{
std::string bundler = "github:matthewbauer/nix-bundle";
- Path outLink;
+ std::optional<Path> outLink;
CmdBundle()
{
@@ -92,18 +92,18 @@ struct CmdBundle : InstallableCommand
if (!evalState->isDerivation(*vRes))
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 bundler '%s' does not produce a bderivation", bundler.what());
+ auto attr1 = vRes->attrs->find(evalState->sDrvPath);
+ if (!attr1)
+ throw Error("the bundler '%s' does not produce a derivation", bundler.what());
PathSet context2;
- StorePath drvPath = store->parseStorePath(evalState->coerceToPath(*i->pos, *i->value, context2));
+ StorePath drvPath = store->parseStorePath(evalState->coerceToPath(*attr1->pos, *attr1->value, context2));
- i = vRes->attrs->find(evalState->sOutPath);
- if (i == vRes->attrs->end())
+ auto attr2 = vRes->attrs->find(evalState->sOutPath);
+ if (!attr2)
throw Error("the bundler '%s' does not produce a derivation", bundler.what());
- StorePath outPath = store->parseStorePath(evalState->coerceToPath(*i->pos, *i->value, context2));
+ StorePath outPath = store->parseStorePath(evalState->coerceToPath(*attr2->pos, *attr2->value, context2));
store->buildPaths({{drvPath}});
@@ -113,10 +113,10 @@ struct CmdBundle : InstallableCommand
if (!info->references.empty())
throw Error("'%s' has references; a bundler must not leave any references", outPathS);
- if (outLink == "")
+ if (!outLink)
outLink = baseNameOf(app.program);
- store.dynamic_pointer_cast<LocalFSStore>()->addPermRoot(outPath, absPath(outLink), true);
+ store.dynamic_pointer_cast<LocalFSStore>()->addPermRoot(outPath, absPath(*outLink), true);
}
};